Java Collection Framework (iii) Collection

Source: Internet
Author: User

Collection is the root interface of a collection framework, and a collection represents a set of objects, which we call elements. Different sets have different characteristics, such as the set can have duplicate elements, some can be ordered, some cannot be sorted, some are unordered, and so on, and collection as the root interface of the set , it defines the general method of the collection, a collection we can be regarded as a small database in memory, and the common operation of the database is no more than "additions and deletions", the method in collection is generally these types of operations.

The Java Collection Framework does not implement collection subclasses directly, but instead uses a series of sub-interfaces, such as List,set,queue, to inherit collection to divide different collection types. Collection's indirect implementation subclass provides two "standard" Construction method, a parameterless construct, a parameter that defines the size of the set, but this is not a mandatory specification for Java, when the collection implementation of the General class follows this rule.

 The method defined in the Colletion interface is the most common operation method in the collection operation, according to the different operation types of the elements can be divided into add, delete, judge, get these four kinds of, set in order to implement the traversal of the element also provides a method to obtain an iterator, in addition to the Java After 8, in order to respond to the current distributed parallel operation requirements, a divisible iterator spliterator (), as well as stream () and Parallelstream () are provided.

Set is an unordered and element-only collection type, which is an abstract representation of the mathematical concepts of things such as cards in poker, courses arranged by students ' schedules, and processes running in computers. The set interface has no more operation methods than Colletion, and his sub-interface SortedSet and Navigableset are expanded to see that the sub-interface method focuses on the comparison and sequencing of elements.

A list is an ordered, element-repeatable collection type that, like an array, can quickly find operations elements by index.

A queue is a queuing structure that is more suitable for storing data than for processing it. Queue is often used to make a first-out (FIFO) storage structure, the newly added elements are stored at the end of the collection, and the elements are removed from the head. Deque is a two-way queue that can do either FIFO or advanced post-out (LIFO).

Java Collection Framework (iii) 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.