1. Collection
1.1 Method
(1) iterator <E> iterator (); returns an iterator used to iterate elements in the set.
(2) int size (); returns the number of elements in the set.
(3) Boolean isempty (); determines whether the current set is null. If it is null, true is returned;
(4) Boolean contains (Object OBJ); returns true if the set contains an object equal to OBJ;
(5) Boolean contains (Collection col); returns true if the current collection contains a set equal to Col;
(6) Boolean add (Object OBJ); if an object obj is added to the set, true is returned;
(7) Boolean addall (Collection col); add all elements in the Set Col to the set. If the set is successful, true is returned;
(8) Boolean remove (Object OBJ); Removes the elements equal to OBJ in the set. If yes, true is returned;
(9) Boolean removeall (Collection col); removes all the elements equal to the col set in the set. If yes and successfully removed, true is returned;
(10) void clear (); removes all elements from the set;
(11) Boolean retainall (Collection col); returns true if all elements in the collection are not equal to those in the col set;
(12) object toarray (); returns an array of objects in the Set;
2 iterator
2.1 Method
(1) Boolean hasnext (); returns true if the next element exists;
(2) E next (); returns the next element;
(3) void remove (); Removes the last accessed object. This method must be executed after accessing an element.
3 list
3.0 (1) ordered list, allowing repeated elements to be stored.
3.0.1 list side
(1) inherit all methods of collection.
(2) listiterator (); returns a list iterator used to iterate all elements in the list.
(3) listiterator (INT index); returns a list iterator starting with the specified subscript.
(4) void add (INT index, e element); add an element at the specified position.
(5) void addall (INT index, collection <? Extends E> elements); adds a set of elements to the specified end.
(6) e remove (INT index); remove the elements at the specified position and return them.
(7) e set (INT index, e element); replace the elements at the specified position with new elements, and return the old list.
(8) int indexof (Object OBJ); returns the subscript of the first element equal to OBJ. If no match exists,-1 is returned.
(9) int lastindexof (Object OBJ); returns the subscript of the last element equal to OBJ. If no match exists,-1 is returned.
3.0.2 listiterator Method
(1) void add (e obj); add OBJ before the current element.
(2) void set (e obj); Use OBJ to replace the element accessed by the next or previous method. If the structure of the list is modified when next or previous is used in the last entry, an exception is reported.
(3) Boolean hasnext (); returns the forward traversal list. If the list iterator has multiple elements, true is returned.
(4) Boolean hasprevious (); returns true if the list iterator contains multiple elements in reverse traversal.
(5) e next (); returns the next element in the list.
(6) e Previous (); returns the previous element in the list.
(7) int nextindex (); returns the index of the elements returned by subsequent calls to next.
(8) int previusindex (); returns the index of the elements returned by previous subsequent calls.
(9) void remove (); remove the last element returned by next or previous from the list.
3.1 arraylist
3.1.1
(1) ordered list, which can be repeated.
(2) The underlying storage uses arrays, which are fast in query, slow In addition, deletion, and insecure in threads. The subscript starts from 0 and is lightweight.
(3) The index sequence can be dynamically increased or reduced
3.1.2 Method
(1) inherit all the methods of list
(2) object clone (); returns a superficial copy of The arraylist instance.
3.2 shortlist
3.2.1
(1) ordered list, which can be repeated,
(2) The underlying layer is implemented by means of a linked list, with fast addition and deletion, slow query, and insecure threads,
3.2.2 Method
(1) void addfirst (E); insert the specified element at the beginning of the list,
(2) void addlast (E); insert the specified element to the end of the list,
(3) e getfist (); returns the first element,
(4) e getlast (); returns the last element of this list.
(5) e removefist (); remove and return the first element in the list
(6) e removelast (); remove and return the last element of the list,
(7) object clone (); returns the superficial copy of this sort list
3.3 Vector
(1) ordered list, repeated allowed, thread safety
(2) The underlying storage uses arrays, thread security, and heavyweight
4 set
4.0
(1) unordered sets. duplicate elements cannot be stored. (except for treeset and sortedset, these two sets have sequences)
4.0.1 Method
(1) inherit all methods of collection
(2) int hashcode (); returns the hash code value of the set.
4.1 hashset
4.1.1
(1) A set without repeated Elements
(2) Hash Table Implementation
4.1.2 Method
(1) inherit all methods in the Set
(2) hashset () constructs a new empty set. The default initial capacity of its instance is 16 and the load factor is 0.75.
(3) hashset (collection <? Extends E> C) construct a set containing elements in the specified collection.
(4) hashset (INT initialcapacity); construct a new set and specify the default initial capacity as initialcapacity;
(5) hashset (INT initialcapacity, float loadfactory); construct a new set. The initial capacity is initicalcapacity. The constructor is loadfactory.
(6) object clone (); returns a superficial copy of The hashset instance, but does not copy the elements themselves.
4.2 treeset
(1) There is no repeated Ordered Set
(2) binary tree implementation
(3) data insertion is slower than hastset, but faster than inserting data into the list.