728px

Operation and interface on linear list in java

Operations :
  1. isEmpty() - Returns true if the List is empty ,false other wise.
  2. size() - Give the number of element in the list.
  3. get(theIndex) - Give the element with gives index.
  4. indexOf(theElement) - Determines the index of a given element.
  5. remove(theIndex) - Removes element with a given index and returns it.
  6. add(theIndex,theElement) - Add a given element so that new element has a specified index. 


Linear list Interface is given below :

public interface LinearList {
    public boolean isEmpty();
    public int size();
    public Object get(int index);
    public int indexOf(Object elem);
    public Object remove(int index);
    public void add(int index, Object obj);
    public String toString();

}