Lists in java

Lists in java:
What is a list?
A list is collection of data.For a real time example consider a list of groceries for a month.You can add,remove,clear,get items from a list.List is actually an interface.
There are several lists collections available in java:


  1. Array list:Most important and useful type of list
  2. LinkedList:Similiar to arraylist with limited functionality
  3. Vector:Similiar to arraylist but it is synchronised class.
  4. Stack:LIFO(Last in first out) collection
Common methods in a list:


  1. add(Object e),add(int index,Object e):adds an element(duh :<).For adding element at specific position pass parameter index.
  2. remove(int index):remove an element at position
  3. clear():clears out the list.Make list empty.


Comments

Popular posts from this blog

Four building blocks of Object oriented programming language

Exceptions and exceptional handling