Garbage Collection In C++, programmer is responsible for the creative of new objects& for destruction of useless objects Usually the programmer is taking very much car while creating object& he is ignoring that destruction of useless objects. Due to this negligence at cretin point of time, memory may not be available for the creation of […]
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 […]
Collections
Collections It is an utility class present in java.util package. It defines several utility methods for collection implemented class object. Sorting a list public static void sort(List l), to sort the elements of List, according to natural sorting order. In this case compulsory Objects should be Homogeneous & comparable otherwise we will get ClassCastException. 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 […]
Queue 1.5 version
Queue This interface has introduced in 1.5 version. If we want to represent, group of Objects Prior to processing, then we should go for Queue. In general Queue follow FIFO, but we can customize based on our requirement. *image* From 1.5 version on wards linkedList also implement Queue interface. LinkedList implementation of Queue always follows […]
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 […]