Monthly Archive: June 2013
We can sort the elements of: String objects Wrapper class objects User-defined class objects Collections class provides static methods for sorting the elements of collection.If collection elements are of Set type, we can use TreeSet. …
The HashMap class is roughly equivalent to Hashtable, except that it is non synchronized and permits nulls. (HashMap allows null values as key and value whereas Hashtable doesn’t allow nulls). HashMap does not guarantee that …
A Hashtable is an array of list.Each list is known as a bucket.The position of bucket is identified by calling the hashcode() method. A Hashtable contains values based on the key. It implements the Map …
Both TreeMap & HashMap are two different implementations of the Map interface. Even though this post is titled “TreeMap vs HashMap” I would like to say how they are connected and how much similar they …
TreeMap class A TreeMap contains values based on the key. It implements the NavigableMap interface and extends AbstractMap class. It contains only unique elements. It cannot have null key but can have multiple null values. …
This class extends HashMap and maintains a linked list of the entries in the map, in the order in which they were inserted. This allows insertion-order iteration over the map. That is, when iterating a …
What is Hashing? Hashing in its simplest form, is a way to assigning a unique code for any variable/object after applying any formula/algorithm on its properties. A true Hashing function must follow this rule: Hash …