Java (article 30) ----- Iterator, java ----- iterator
Iteration is no stranger to Java. We often use the iterative interfaces provided by JDK to iterate Java sets.
Iterator iterator = list.iterator(); while(iterator.hasNext()){
Definition:Provides a method to access each element in a container object without exposing the internal details of the object.
Type:Behavior mode
Class diagram:
If you want to ask the most common mode in Java, the answer is not the singleton mode,
vector Container
Vectors are a collection of objects of the same type, each with a corresponding integer index value. As with string objects, the standard library is responsible for managing the associated memory of the storage element. We refer to
PS One sentence: Eventually choose Csdn to organize the publication of the knowledge points of these years, the article parallel migration to CSDN. Because CSDN also support markdown grammar, Ah!"Craftsman Joshui Http://blog.csdn.net/yanbober" read
Reverse iterator and reverse iterator
C ++ primer (fourth edition of Chinese Version) page 273rd
9.3.2 begin and end members
The begin and end operations generate an iterator pointing to the next position of the first and last elements in the
Definition: provides a way to access each element of an aggregation object sequentially without exposing the internal details of the object.
Type: object behavior pattern
class Diagram:
If you want to ask one of the most used patterns in Java, the
Iterator object and Iterator generator object
Directory:
Use of Iterator
"Iteration string set Iteration object set
Graph and Principle Analysis of the iterator
Java iterator source code
Iterator usage:
"Iteration string set
In. net, the iterator mode is encapsulated by ienumerator, ienumerable, and their corresponding generic interfaces. If a class implements the ienumerable interface, it can be iterated. Calling the getenumerator method will return the implementation
5. JDK built-in iterator
To make it easier for developers to operate aggregate objects, a built-in iterator is provided in Java, C #, and other programming languages. In the Java Collection framework, common aggregate classes such as list and set
Definition: provides a way to access the elements of a container object without exposing the internal details of that object.Type: behavior class patternclass Diagram:
If you want to ask one of the most used patterns in Java, the answer is not a
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.