Home  >  Article  >  Java  >  What does java iteration mean?

What does java iteration mean?

little bottle
little bottleOriginal
2019-05-22 14:37:458439browse

Java is a computer programming language. Iteration, on the other hand, is the activity of repeating a feedback process, usually with the goal of approaching a desired goal or outcome. And what combines them? Next I will tell you about Java iteration

What does java iteration mean?

Repeat once for a subroutine* (a set of instructions) that needs to be executed repeatedly in a Java program, that is, repeated execution Looping in a program until a certain condition is met is called Java iteration.

When it comes to Java iteration, what we have to mention is Java’s iterator pattern.

Iterator mode, also called cursor mode.

The Iterator pattern accesses the elements of a collection object in a sequential manner without knowing its underlying representation.

The definition given by GOF is to provide a method to access each element in a container object without exposing the internal details of the object.

The iterator pattern consists of the following roles:

1) Iterator role (Iterator): The iterator role is responsible for defining the interface for accessing and traversing elements.
2) Concrete Iterator: The concrete iterator role must implement the iterator interface and record the current position during traversal.
3) Container role (Container): The container role is responsible for providing an interface for creating specific iterator roles.
4) Concrete Container: The concrete container role implements the interface for creating a specific iterator role - this specific iterator role is related to the structure of the container.


The above is the detailed content of What does java iteration mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What are java modifiers?Next article:What are java modifiers?