collection methods

 Collection Methods:


  •  boolean add(E obj)

this method adds a new element to the end of the List.

  • void add(int position, E obj)

this method insert a new element into the List at the specified position.

  •  boolean remove(E obj)

this method removes specified elements from the List(manual boxing is needed)

  • E remove(int position)

this method removes the particular element from the List at the specified position.

  • int size()

this method returns the count of the number of elements available in the List.

  • void clear()

this method removes all the elements from the List

  • boolean isEmpty()

this method returns true if List does not contain any element otherwise it returns false 

  • boolean contains(E obj)

 this method returns true if a specified element is available in the list otherwise it returns false

  • E get(int position)

this method returns the element from the List at the specified position. 

this method is especially used to access the Elements of the List. 

  • E set(int position, E obj)

this method replaces the new Element at the specified position in the List.


Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.