1) It is child interface of Set.
2) If we want to represent a group of “unique objects” according to some sorting order then we should go for SortedSet interface.
3) That sorting order can be either default natural sorting (or) customized sorting order.
• SortedSet interface define the following 6 specific methods.
Continue reading SortedSet
• If we want to get objects one by one from the collection then we should go for cursor. There are 3 types of cursors available in java. They are:
Continue reading The 3 cursors of java
1) It is the child class of HashSet.
2) LinkedHashSet is exactly same as HashSet except the following differences.
Continue reading LinkedHashSet
1) The underlying data structure is Hashtable.
2) Insertion order is not preserved and it is based on hash code of the objects.
3) Duplicate objects are not allowed.
4) If we are trying to insert duplicate objects we won’t get compile time error and runtime error add() method simply returns false.
5) Heterogeneous objects are allowed.
6) Null insertion is possible.
7) Implements Serializable and Cloneable interfaces but not RandomAccess.
Continue reading HashSet
1) It is the child interface of Collection.
2) If we want to represent a group of individual objects where duplicates are not allow and insertion order is not preserved then we should go for Set interface.
• Set interface does not contain any new method we have to use only Collection interface methods.
1) The underlying data structure is double LinkedList
2) If our frequent operation is insertion (or) deletion in the middle then LinkedList is the best choice.
3) If our frequent operation is retrieval operation then LinkedList is worst choice.
4) Duplicate objects are allowed.
5) Insertion order is preserved.
6) Heterogeneous objects are allowed.
7) Null insertion is possible.
8) Implements Serializable and Cloneable interfaces but not RandomAccess.
Continue reading LinkedList
1) The underlying data structure is resizable array (or) growable array.
2) Duplicate objects are allowed.
3) Insertion order is preserved.
4) Heterogeneous objects are allowed.
5) Null insertion is possible.
6) Implements Serializable,Cloneable and RandomAccess interfaces.
Continue reading Vector
1) It is the child class of Vector.
2) Whenever last in first out order required then we should go for Stack.
• It contains only one constructor.
Stack s = new Stack();
Continue reading Stack
• Collections class defines the following method to return synchronized version of List.
Public static List synchronizedList(list l);
Continue reading Getting synchronized version of ArrayList object
1) In ArrayList ,no any method is synchronized
2) At a time multiple Threads are allow to operate onArrayList object and hence ArrayList object is not Thread safe.
3) Relatively performance is high because Threads are not required to wait.
4) It is non legacy and introduced in 1.2v
Continue reading Differences between ArrayList and Vector?