java learning day18 - Collection collection

Collection collection

    The concept of the collection:

      It is used to store a set of reference data type container, when adding the basic data types , the system automatically packing wrapper class objects to add to the collection

 

 

    Collection are two major categories:

      Collection Collection: accessing data is a single access

      Map collections: a press < key, value> pairs form of access to data, such as: < "lisi", 18> , < "zhangsan", 20>

 

 

    Collection of a set of common methods:

      When you define Collection object, as Collection is an interface, you need to assign implementation class objects

      

 

    

      Usually only one set of a type of data storage, can be generic to constrain the set of element types in

      

 

 

      add () method: add elements to the collection

       

 

 

      isEmpty () : whether the specified set is empty

      size () : the number of elements in the set is determined

      contains (element name) : determining whether the element is present

      

    

 

      remove (element name) : remove the first matching element.

 

 

      toArray (array name) : the collection into an array

      

 

 

 

 

      

Guess you like

Origin www.cnblogs.com/javaisbest/p/11741235.html