GoConqr has a new look! Let us know what you think.

Flashcards

ArrayList cards

alim586 English 7 cards

Cards in this deck (7)

  1. 1Accessing elements of ArrayList with..- Enhanced for loop
    - Iterator
    -ListIterator
  2. 2Accessing elements of an ArrayList with Enhanced for loopArrayList arrList = new ArrayList <>();
    For (int i : arrList) { System.out.println (i); }
  3. 3Accessing elements of an ArrayList with ListIteratorArrayList arrList = new ArrayList<>();
    arrList.add(new StringBuilder(" a " ));
    arrList.add(new StringBuilder(" b "));
    ListIterator iterator = arrList.listIterator();
    while( iterator.hasNext () ){
    System.out.print(iterator.next();
    }
  4. 4Modifying the elements of an ArrayListby using the method set();
    or accessing its individual elements
  5. 5ArrayList defines two methods to remove its element- remove(int index); removes at specified position
    remove(Object o); removes the first occurrence of the specified element from this list, if it's present
  6. 6Method to clear an ArrayListYou can remove all the elements in an ArrayList by calling clear()
  7. 7Methods for Accessing ArrayList elements- get(int index) -- returns the element at the specified position
    - size() -- returns the number of elements
    - contains(Objec o) -- returns true if an ArrayList contains the specified element
    - indexOf(Object o) -- returns the index of the first occurrence of the specified element in the list, or -1 if it does not exist
    - lastIndexOf(Object o) -- returns the last occurrence of the specified element in the list, or -1 if it does not exist

Information

Description
Flashcards on ArrayList cards, created by alim586 on 19/06/2015.
Created by
alim586
Views
6
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?