Month: December 2018

TreeSet

TreeSet The underlying data structure is balanced tree. Duplicate objects are not allowed. All elements will be inserted, according to some sorting order hence insertion is not preserve. Heterogeneous objects are not allow, violation leads ClassCastException. Constructors:- TreeSet t = new TreeSet (); // natural sorting order. creates an empty TreeSet object where all the […]

SortedSet

SortedSet It is the child interface set. If we want to represent a group of objects without duplicates, according to some sorting order, then we should go for SortedSet interface. The sorting order can be natural sorting order or customized sorting order. SortedSet defines the following six specific methods. Object first (); Object last (); […]

Set

Set It is the child interface of collection. If insertion order is not required & duplicate objects are not allowed. Then we should go for set interface. Set interface doesn’t contain any new method, hence we have to use only collection interface method. * image *         Constructor HasSet h = new […]

Vector

Vector The underlying data structure is resizable or growable array. Insertion order is preserve. Duplicate objects allow. Null insertion is possible. Heterogeneous objects are allow. Vector class implements Serialization, Cloneable & RandomAccess  interface. Best suitable for frequent operation is retrieval. Worst choice is Frequent operation is insertion or deletion on middle. Every method present in […]

LinkedList

LinkedList The underlying data structure for LinkedList is double LinkedList. Insertion order is preserve. Duplicate objects are allowed. Heterogeneous objects are allowed. Null insertion is possible. Emplements Serializable & Cloneable interface but not Random Access. LinkedList is not suitable if our frequent operation is not retrieval operation. Constructors:- LinkedList l = new LinkedList (); creates […]

Array List

Array List The underlying  data structure is resizeable Array or growable Array. Insertion order is preserved. Duplicate objects are allowed. Hetrogenious objects are allowed. Null insertion is possible. Constructors of ArrayList ArrayList l = new ArrayList () ↔   creates an empty ArrayList object with default intial capacity 10. ↔  If arraylist reaches its max […]

Vector

Vector The underlying data structure is resizable or growable Array. Insertion order is preserve. Duplicate objects are allow. Null insertion is possible. Hetrogenious objects are allow. Vector class implements Serializable, Clonable & RandomAccess interface. Best suitable for frequent operation is retrieval. Worst  choice is frequent operation is insertion or deletion on middle. Every method present […]