First, Collection
1.static Method:
Collections.sort (list<t>): Implementing the List sort function
Collections.fill (list<t>, Object o): Change the contents of this container to a container that has already been added, all of which is this value
Second, List
ArrayList: Random retrieval is fast, but insertion, deletion time.
1.static Method:
Add (): adding elements
AddAll (list): Add a list in, if the array is to be converted to List, you can use Arrays.aslist (a []);
Clear: Clear the elements in the container
Set (Index a,object o): replace element
Size (): container sizes, need to have elements in case
IsEmpty (): Determines whether the container is empty
Contains (Object o): see if this element exists in the container
Iterator (): The bottom traversal of the container, Hasnext (): whether there is a next element, next (), is the next value.
Sublist (Index Low,index High): Part of the Intercept container comes out
Swap (List, A, B): Implements the Exchange value
LinkedList: Easy to insert and delete, but inconvenient and random search (sort by insert order)
List can be sorted using the Collections.sort method, the list container cannot exclude the same object and basic data type, and the data can be stored in this container as long as it belongs to this generic type.
Third, Set (the data stored is unique, for storing reference type objects, as long as the address is different, will also be stored in), the basic method is to cover the list above!
HashSet: The advantage is quick access. Storage is not written in the order of data, but is stored randomly!
TreeSet: The stored elements are sorted, and the String is sorted by a-Z and then A-Z.
Linkedhashset: Stores are sorted in the order in which they are entered.
Map main application and the mapping between list and Set key VALUE
static method:
Put (key, value); Storing data
HASHMAP: Convenient random access
TreeMap: Sort the elements well
Linkedhashmap: Storage by the sort of stored data
Hashcode and equals rewrite issues!!!!!!!
Other knowledge:
You can use the Aslist method to convert an array to a container: Arrays.aslist ("Once-three Fort ddd". Split (""));
String.case_insensitive_order
The comparable contains CompareTo
Java Container Some knowledge