Skip to main content

Posts

Showing posts with the label Stack

What is List interface in Java | Guide to ArrayList, LinkedList and Vector Class

List interface in Java with ArrayList, LinkedList and Vector Class    List Interface (java.util.List) : List is an ordered collection. It is also known as sequence. List is child interface of Collection framework . List comes under java.util package. We can access any element by their index and search for element also in the List. List maintains ordered elements and duplicate also. Methods of List Interface : add() addAll() clear() contains() containsAll() equals() get() hashCode() indexOf() isEmpty() iterator() lastIndexOf() listIterator() remove() removeAll() retainAll() set() size() subList() toArray() For use functionality of List interface we can use following classes : ArrayList LinkedList Vector Stack ArrayList Class : We can say, ArrayList is better version of Array. It is resizable array. means as simple array, we does not have to specify size of array. The Java ArrayList class can store a group of many objects. We can not store primitives (int, double, float, etc) in...