Skip to content

[Edit] Java: iterator #7320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mamtawardhani
Copy link
Collaborator

Description

[Edit] Java: iterator

Issue Solved

Closes #7257

Type of Change

  • Editing an existing entry (fixing a typo, bug, issues, etc)

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@mamtawardhani mamtawardhani marked this pull request as ready for review July 11, 2025 07:52
@mamtawardhani mamtawardhani added enhancement New feature or request java Java entries status: under review Issue or PR is currently being reviewed labels Jul 11, 2025
@codecademy-docs
Copy link
Collaborator

@mamtawardhani add simpler and short examples. We should also tell what is cursor?

CatalogContent:
- 'learn-java'
- 'paths/computer-science'
---

An **iterator** is an object that allows code to step through collections. Java has `Iterator` and `ListIterator` objects, both imported through the `java.util` package. The main difference between the two is that `ListIterator` allows for the bidirectional traversal of collections. The `ListIterator` can only be retrieved from collections that implement the `List` interface.
Java **iterator** is an interface that provides a standardized way to traverse elements in a collection sequentially, one element at a time. It acts as a cursor that points to elements within collections such as [`ArrayList`](https://www.codecademy.com/resources/docs/java/array-list), `LinkedList`, [`HashSet`](https://www.codecademy.com/resources/docs/java/hashset), and other classes that implement the [`Collection`](https://www.codecademy.com/resources/docs/java/collection) interface. The iterator interface is part of the Java Collections Framework and is found in the `java.util` package.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not defining what a cursor is.
We should define that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request java Java entries status: under review Issue or PR is currently being reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Edit] Java: iterator
3 participants