Java.lang
The Interface iterable<t> implements the interface so that the For-each loop can be used.
Java.util
Interface iterator<e> is used to traverse collection, there is a hasnext (), Next (), remove () method.
Java.util
Interface collection<e> The root interface in the entire Collection system, the parent interface is iterable. Iterator can be generated.
Java.util
Interface map<k,v> Map is not collection, it can only generate collection. Iterator is a function of collection and cannot be used directly in map.
Java.util
Public static Interface map.entry<k,v> is a nested class of map<k,v>, and a map.entrymap is an entry in the Map. The map's EntrySet () method returns SET<MAP.ENTRY<K,V>>, which can be used to traverse the map.
// recommended, especially when the capacity is large 2 for (map.entry<string, string> entry:map.entrySet ()) {3 System.out.println ("key=" + Entry.getkey () + "and value=" + Entry.getvalue ()); 4 }
Java.util
Class abstractcollection<e> This abstract class gives the most basic implementation of the class collection interface, minimizing the work of the collection interface. Abstractlist, Abstractqueue, Abstractset, Arraydeque a truth.
Java.util
collections and Arrays are tool classes, and all methods are static. Collections a common method
public static <T> Boolean addall (collection<? super t> C, T ... elements) adds elements to Collection, Elements can be either one or an array.
Arrays also has a similar approach to public static <T> list<t> aslist (T ... a).
Java Iterator iterable Collection abstractcollection Map Relationship