The 11th chapter: set (i)

Source: Internet
Author: User

A collection is also called a container, similar to an array, and is the whole of the same type of elements.

    1. The collection has the following excuse Collection interface

      Iterator Interface

List interface and implementation class

Set interface and implementation class

Map interfaces and implementation classes

The 2.Collection interface provides common operations for the collection interface:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/51/wKioL1X6UM2Cf3V3AAJcXBI2OaY449.jpg "style=" float: none; "title=" pilcz.jpg "alt=" Wkiol1x6um2cf3v3aajcxbi2oay449.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/51/wKioL1X6URDwCMrVAAK_SUstzog788.jpg "style=" float: none; "title=" jibcz.jpg "alt=" Wkiol1x6urdwcmrvaak_sustzog788.jpg "/>



3.List interface and set interface

    1. A List interface whose implementation class creates an ordered set of elements with subscript and repeating elements.

      The main realization class has ArrayList , linkedlist ,Vector .

    2. A set interface whose implementation class creates an unordered collection that does not allow duplicate elements.

      The main implementation classes are HashSet , linkedhashset , TreeSet .

4. Iterating through the collection

  1. For-each structure Traversal

    for (Object o:c) {

    System.out.print (O.tostring ());

    }

  2. Iterator iterator traversal

    public interface iterator<e>{

    public boolean hasnext ();

    Public E next ();

    public void Remove ();

    }



The 11th chapter: set (i)

Related Article

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.