public interface Iterator<E> {
boolean hasNext();
E next();
void remove(); //optional
}
public static void main (String[] args) {
List<String> names = new ArrayList<String>();
names.add("John");
names.add("Jane");
names.add("Dan");
names.add("Suzie");
for(String name : names) {
System.out.println(name);
}
}
names.remove("John");
names.add("John");
int size = names.size();
boolean found = names.contains("John");
int index = names.indexOf("John");
List<String> names = ArrayList<String>();
...
Collections.sort(names);
List<String> filledList = ArrayList<String>();
List<String> emptyList = ArrayList<String>();
...
Collections.sort(emptyList, filledList);
public static void main (String [] args) {
Set<String> names = new HashSet<String>();
names.add("John");
names.add("Jane");
System.out.println(names);
}
public static void main(String [] args) {
Map<String, String> myMap = new HashMap<String, String>();
myMap.put("John", "Seattle");
myMap.put("Dan", "Nashville");
}