Java Source (4)--java.util.Collection

Source: Internet
Author: User

I do not know what to look at the source code, just want to see ...

Java.util.Collection This is an interface, which is the root interface of the collection framework in Java.

Here's a look at some of the methods defined in the interface

Public interface collection<e> extends iterable<e>{    //methods for manipulating collection elements    Boolean add (e e);//add element E to the collection    boolean addall (collection<? extends e> c);//Add the collection C to the collection as a    boolean remove (Object o);//Remove the O element    from the collection Boolean RemoveAll (collection<?> c);//delete the C set    void Clear () from the collection,//Empty the collection with a    boolean retainall (Collection <?> c)////Only the elements in the collection that are also contained in the specified set C    //Query method    Boolean contains (Object o);//Determine whether the element o is in the collection    Boolean Containsall (collection<?> c);//Determines whether set C is a    boolean isEmpty () in the set, or whether the collection is an element    int size ();// Returns the number of elements of the collection    //Other methods    object[] ToArray ();    <T> t[] ToArray (t[] a);    Iterator<e> Iterator ();    Boolean equals (Object O);    int hashcode ();}

  

You can see the above collection interface 16 methods, the operation of the collection element method has 6, the query method has 4, the other method has 5. This is just an interface, all of which are defined method bodies, followed by a detailed analysis of how each method is implemented in its implementation class (it is very exciting to have a personal sense of how to implement the above 16 methods in an implementation class)

Java Source (4)--java.util.Collection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.