Stack Class in Java Example

Stack class in java is one of the collection interface class which is subclass of Vector class. Stake class supports usual push and pop operations. In contrast to queue, Stack class has last-in first-out(LIFO) data structure. So item which is inserted at top will be available first. Stack class extends Vector class of List interface … Read more

Vector Class In Java

Vector class in java implements List interface of collection framework. Vector class is synchronized. If you don’t know size of array then you can use vector class as size of vector can grow and shrink as per adding and removing items. As vector class is synchronized, It will give poor performance on add, delete, update … Read more

LinkedList In Java

LinkedList class extends AbstractList class. LinkedList class implements List and Deque interfaces. LinkedList class is using doubly linked list to store elements in list. LinkedList can hold duplicate elements in list. LinkedList is non synchronized. Manipulation is faster in linkedlist as shifting is not required when new element is inserted or deleted from list. You … Read more

Java ArrayList Class

ArrayList class is sub class of collection interface which implements to List interface. ArrayList class provides resizable-array so it can grow automatically as per requirement which resolves fixed Array limitation where you have to pre-define the size of array. It can hold null elements too. It is not synchronized implementation so if multiple threads accessing … Read more