Αποτελέσματα Αναζήτησης
4 Οκτ 2024 · The java.util.Hashtable.contains(Object value) method in Java is used to check whether a particular value is being mapped by any keys present in the Hashtable. Syntax: Hash_table.contains(Object value) Parameters: The method accepts one parameter value of object type and refers to the value of the hashtable whose mapping is to be verified.
6 Φεβ 2014 · The Hashfunction calculates an Hashvalue for each data object and put this hashvalues into a table (each value should get its own bucket). With the hashvalue we know the exact position of the data object in the table. What role does the key play here?
8 Ιαν 2024 · When we put an entry into a Hashtable and get it out of it, we expect that the value can be obtained not only with same the instance of the key but also with an equal key: Word word = new Word("cat"); table.put(word, "an animal"); String extracted = table.get(new Word("cat"));
This class implements a hash table, which maps keys to values. Any non- null object can be used as a key or as a value. To successfully store and retrieve objects from a hashtable, the objects used as keys must implement the hashCode method and the equals method.
30 Ιαν 2017 · First, you have to understand a what a hash function is. A hash function is a function that takes a key (for example, an string of arbritrary length) and returns a number as unique as possible. The same key must always return the same hash. A really simple string hashing function in java might look like.
11 Απρ 2016 · I've created a method which looks for a Key and returns the value. public Object findValue (String Name) { for (Object o: hashMap.entrySet ()) { Map.Entry entry = (Map.Entry) o; return entry.getValue (); } return null; }
9 Οκτ 2021 · The java.util.Hashtable.keys () method of Hashtable class in Java is used to get the enumeration of the keys present in the hashtable. Illustration: Syntax: public Enumeration<K> keys() Enumeration enu = Hash_table.keys(); Return value: An enumeration of the keys of the Hashtable. Example 1: