Java Collection Collection,map

Source: Internet
Author: User
Tags iterable

Roughly divided into set,list,queue,map four kinds of system

Set represents unordered, non-repeatable collections, accessed through the element itself

The list represents an ordered, repeatable collection, accessed through an element index

Map represents a collection of mappings, accessed by key

Queue represents an implementation of a collection of queues

The collection interface is the parent interface of List,set,queue, which defines the following set of methods: Add,addall,clear,contains,containsall,isempty,iterator,remove, Removeall,retainall,insize,toarray

All classes that implement collection override the ToString method to output all elements of the collection at once

Iterable is the parent interface of the collection interface, Java provides a foreach default method for Iterable, and the parameter is a function interface (an interface that contains only one method)

Collection books = new HashSet ();

Books.add ("a"); Books.add ("B");

Books.foreach (Obj->system.out.println ("iterative element" +obj));

Java Collection Collection,map

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.