9 key interfaces of collection framework:  1. Collection Interface : If we want to represent a group of individual objects as a single entity then we should go for collection. Collection interface defines the most common methods which are applicable for any collection object. For ex:- Add Object Remove Object Contains() In general collection interface […]

Read More →

List(I) Interface: Contains all the methods of collection and has its own method. List is the child interface of collection. If we want to represent a group of individual objects as a single entity where duplicates are allowed and insertion order preserved then we should go for list. Legacy classes (vector and stack):-Classes coming from […]

Read More →

Stack Class : It is child class of vector It is specially designed class for last in first out order(LIFO) CONSTRUCTOR Stack s = new stack(); Operations: push(Object o) pop() offset peek()           s.search(A) //3 s.search(Z) ;//-1     Methods: Object push(Object obj):-For inserting an object to the stack. Object pop():-To […]

Read More →

Vector Class :  The underlying datastructure is resizable array or growable array.  Insertion order is preserved.  Duplicates objects are allowed.  Heterogeneous objects are allowed.  Null insertion is possible.  Vector implements Serializable, Cloneable interfaces and Random Access interfaces.  Vector is the best choice if our frequent operation is retrieval.  Linked List is the worst choice if […]

Read More →

ArrayList LinkedList 1. It is the best choice if our frequent operation is retrieval. 1. It is the best choice if our frequent operation is insertion and deletion in the middle. 2. ArrayList is the worst choice if our frequent operation is insertion or deletion in the middle. 2. LinkedList is the worst choice if […]

Read More →

LinkedList class :  The underlying datastructure is Double Linked List.  Insertion order is preserved.  Duplicates are allowed.  Heterogeneous objects are allowed.  Null insertion is possible.  Linked List implements serializable and cloneable interfaces but not Random Access interfaces.  Linked List is the best choice if our frequent operation is insertion or deletion in the middle.  Linked […]

Read More →

ArrayList class :  Resizable Array or growable array.  The underlined datastructure resizable and growable array.  Duplicates are allowed.  Insertion order is preserved.  Heterogeneous objects are allowed(Except Tree Set and Tree Map everywhere heterogeneous objects are allowed).  Null insertion is possible. CONSTRUCTOR: ArrayList l = new ArrayList():- Creates an empty ArrayList object with default initial capacity […]

Read More →

ArrayList and Vector both implements List interface and maintains insertion order. ArrayList Vector 1. Every method present in ArrayList is non-synchronized. 1. Every method present in ArrayList is synchronized. 2. At a time multiple threads are allowed to operate on ArrayList object and hence ArrayList is not thread safe. 2. At a time only one […]

Read More →

NEED OF COLLECTIONS: We have two approach: Individual variable approach: Array Individual variable approach: Suppose we want to create or store one int value in the memory. Like int x=10, here x is representing INT type value, now suppose I want to store one more value I will create another variable int y=10;So on and […]

Read More →

What is Object Oriented Programming ? It is style of programming in which a large application software is implemented in terms of independently programmable units of “data” (in the form of fields, often known as attributes) and “operations” or “codes” (in the form of procedures, often known as methods) called objects. BASIC ELEMENTS OF OOP […]

Read More →