Month: January 2019

Arrays

Arrays Class This Class Present in java.util package. It defines several utility methods applicable for arrays. Sorting the elements of Arrays:-Arrays class defines the following three methods to perform sorting. Public static void sort(Primitive[] p) to sort the elements of primitive array, according to natural sorting order. Public static void sort(Object[] o) to sort the […]

Enhancement 1.6 version

Enhancement Sun people introduces, the following 2 interface in 1.6 version as the part of collection Framework. 1) NavigableSet 2) NavigableMap. NavigableSet It is the child interface of SortedSet, which defines several methods to support navigation. Ceiling(e): It returns the lowest element, which is greater than equal to e. Higher(e): Returns the lowest element which […]

Properties

Properties It is the child class of Hashtable. In this case both key and value should be String Object only. Constructor Properties p = new Properties () Important methods of Properties String getProperty (String name). Return the value associated with the specified Property. If the specified property is not available then we will get null. […]

WeakHashMap

WeakHashMap It is exactly same as HashMap, except the following difference. In the case of HashMap, an object is not eligible for garbage, if it is associated with HashMap, even though it doesn’t contain any external reference. i.e HashMap dominates garbage collector. But in the case of WeakHashMap, if an object is not having any […]

LinkedHashMap

LinkedHashMap It is exactly same as HashMap,except the following differences. HashMap LinkedHashMap The underlying data structure is Hashtable. Insertion order is not preserve. Introduce in 1.2 version. The underlying data structure is Hashtable and LinkedList. Insertion order is preserve. Introduce in 1.4 version. In the above, if we are replacing HashMap LinkedHashMap, the following is […]

HashMap

HashMap The underlying data structure is Hashtable. Hashing insertion order is not preserve, because it based on Hashcode of keys. Duplicate keys are not allowed. But values can be duplicated. Heterogeneous objects allowed for both keys& value. Null key is allowed. Null values are allowed, any null of times. Difference between HashMap& Hashtable:- HashMap Hashtable […]

Map interface

Map interface If we want to represent group of objects as key- value pairs, then we should go for Map interface. Both key & value are objects only. Duplicated. Each key- value pair is consider as entry. hence a map is consider as a Set of entries. Collection interface mean for individual objects, where as […]