Java/Iterators: Difference between revisions
From charlesreid1
(Created page with "See Iterators vs Iterable") |
No edit summary |
||
| Line 1: | Line 1: | ||
See [[Iterators vs Iterable]] | See [[Iterators vs Iterable]] | ||
Iterators | |||
* Iterators are simple wrapper classes around references to locations in a container. | |||
* The Iterator class works a bit like a scanner, with methods to check if there is a next token, get the next token, and remove the last token returned. | |||
Iterable | |||
* Iterable is the generic approach for getting some kind of iterator that will operate on this collection. | |||
* Implementing Iterable is what enables the use of for each syntax. | |||
[[Category:Java]] | |||
[[Category:Iterators]] | |||
[[Category:Iterable]] | |||
{{CSFlag}} | |||
Latest revision as of 00:51, 26 June 2017
Iterators
- Iterators are simple wrapper classes around references to locations in a container.
- The Iterator class works a bit like a scanner, with methods to check if there is a next token, get the next token, and remove the last token returned.
Iterable
- Iterable is the generic approach for getting some kind of iterator that will operate on this collection.
- Implementing Iterable is what enables the use of for each syntax.
| Computer Science notes on computer science topics on the wiki, for educational and learning purposes
Part of the 2017 CS Study Plan.
Python/Exceptions · Python/Assertions · Python/Decorators Python/Os (os module) · Python/Strings Python/Splat · Python/Iterators · Python/Generators Python/Comparators · Python/Lambdas
Builtin features of Java: Java/Exceptions · Java/Assertions · Java/Memory · Java/Interfaces Java/Generics · Java/Decorators · Java/Diamond Notation Java/Iterators · Java/Iterable · Iterators vs Iterable Java/Comparators · Java/Comparable · Comparators vs Comparable Java/Numeric · Java/TypeChecking · Java/Testing · Java/Timing · Java/Profiling Documentation: Javadocs · Java/Documentation Tools and functionality: Java/URLs · Java/CSV External libraries: Guava · Fastutil · Eclipse Collections OOP: OOP Checklist · Java/Abstract Class · Java/Encapsulation · Java/Generics
|
See also: