Java Collection--Summary (a) __java

Source: Internet
Author: User
The existence of a set

Arrays and collections can be used as containers to store data, but the length of the array is fixed and does not apply to storing unknown amounts of data.
Collection frame (stolen map, hahaha, the solid line border is the implementation class, the polyline border is an abstract class, and the dotted border is an interface)

Although there are some missing classes or interfaces, it can be seen from the diagram that the Java set is divided into two categories, one is the implementation of the collection interface set, which leads to its subclass, List, Set, Queue, and its more advanced subclasses or implementation classes, ArrayList, LinkedList and so on; the other is to implement a collection of map interfaces, including HashMap, Hashtable, and so on.

Closely related to the set is the iterator iterator, which is used primarily to traverse the elements in the collection, where next (), the Hasnext () method is an iterative two important method. By repeatedly calling next, you can access each element in the collection one at a time, and if you reach the end of the collection and then call the next method, the Nosuchelementexception is thrown, so you need to call Hasnext before calling next to determine if there are any accessible elements in the collection. The next method is like crossing the next element and returning the reference to the element that was just there. So if you want to delete the first element in the collection, you still need to call next, and then remove

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.