Iterator INTERFACE ANALYSIS

Source: Internet
Author: User

A terator is a set iterator. You do not need to care about the implementation of the set through the iterator access interface.
The iterator interface defines three methods:
1. hasnext ()
Whether there is another element.
2. Next ()
Returns the next element.
3. Remove ()
Delete the current element.

Only three simple methods are defined. Pay attention to the following points:
1) differences between iterator and enumeration
Iterator is used to replace enumeration. Enumeration only defines two methods and does not have the delete function.
2) The remove () method can be called only after the next () method is called, and the remove () method can only be called once at most once after each next () method is called. Otherwise, an illegalstateexception is thrown.

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.