Shared Flashcard Set

Details

Java Collections (programming snips)
Language refresher focussed on collections framework in Java
6
Computer Science
Professional
08/22/2015

Additional Computer Science Flashcards

 


 

Cards

Term
ArrayList al = new ArrayList(); // create Iterator it = al.iterator(); // iterate while(it.hasNext()) { System.out.println(it.next()); // get data }
Definition
Term
import java.util.*;
Definition
Term
HashSet al = new HashSet(); al.add("DATA"); Iterator itr = al.iterator(); while(it.hasNext()) { System.out.println(it.next); }
Definition
Term
LinkedHashSet al = new LinkedHashSet(); -- add, iterator TreeSet al = new TreeSet(); -- add, iterator
Definition
Term
Methods of Queue interface

public boolean add(object);
public boolean offer(object);
public remove();
public poll();
public element();
public peek();
Definition
Term
Hashtable hm = new Hashtable(); hm.put(100, "DATA"); ... for(Map.Entry m:hm.entrySet()){ System.out.println(m.getKey() + " " + m.getValue()); } hashtable is legacy class.
Definition
Supporting users have an ad free experience!