List interface analysis

xiaoxiao2021-03-06  53

The List interface is inherited from the Collection interface, about the Collection interface: http://blog.9cbs.net/treeroot/archive/2004/09/09/99591.aspx

List is an orderly collection that can access the data in the collection by indexing, see what methods in the list

1. whit size () inherits from Collection

2 Boolean ISempty () inherits from Collection

3. Boolean Contains (Object O) Inherited from Collection

4.ITERATOR ITERATOR () inherits from Collection

5.Object [] toarray () inherits from Collection

6. Object [] Toarray (Object A []) inherits from Collection

7. Boolean Add (Object O) Inherited from Collection to the end of List

8. Boolean Remove (Object O) Inherited from Collection

9.Boolean ContainSall (Collection C) inherits from Collection

10.Boolean Addall (Collection C) Inherits from the collection to the end of List, equivalent to method addall (size (), Collection C)

11.Boolean Addall (INT INDEX, COLLECTION C) Add all elements in a collection at the specified index, after the index (including the current index) is removed after the index

12. Boolean Removeall (Collection C) Inherited from Collection

13. Boolean Retainall (Collection C) inherits from Collection

14.void clear () inherits from Collection

15. Boolean Equals (Object O) Inherited from Collection

16.int hashcode () inherits from Collection

17. Object Get (int index) Returns the specified element via the index number

18. Object Set (int index, object element replaces the element at the specified index to the new element, returns the original alternative element, pay attention to the index cannot be off, do not try to use set (size (), newElement) to insert data .

19.void Add (Object Element) Insert an element at the specified index, which is behind the index or behind the elements behind.

20. Object Remove Deletes the elements at the specified index, move forward behind the elements.

21.int INDEXOF (Object O) Returns the index (minimum) of the specified element in the list, if the element is not present, return -1.

22.int LastIndexOf (Object O) is similar to the above, returning the maximum.

23.Listiterator ListIterator () Returns the list iterator, which is equivalent to Listiterator (0).

24.Listiterator ListIterator (int index) Returns a list iterator that specifies the initial location.

25.List Sublist (int.comIndex, int toindex) Returns a view of the current list, not to return a sub-list, and it is a view because the non-interface modification of the returned List will affect the original list.

转载请注明原文地址:https://www.9cbs.com/read-117018.html

New Post(0)