Update iterator readme

This commit is contained in:
Ilkka Seppälä 2021-06-20 22:06:42 +03:00
parent 1f6833986e
commit 86362e12f6
No known key found for this signature in database
GPG Key ID: 31B7C8F5CC412ECB

View File

@ -19,10 +19,10 @@ underlying representation.
## Explanation ## Explanation
Real world example Real-world example
> Treasure chest contains a set of magical items. There multiple types of items such as rings, > Treasure chest contains a set of magical items. There multiple types of items such as rings,
> potions and weapons. The items can be browsed by type using an iterator the treasure chest > potions, and weapons. The items can be browsed by type using an iterator the treasure chest
> provides. > provides.
In plain words In plain words
@ -113,7 +113,7 @@ public interface Iterator<T> {
} }
``` ```
In the following example we iterate through the ring type items found in the chest. In the following example, we iterate through the ring-type items found in the chest.
```java ```java
var itemIterator = TREASURE_CHEST.iterator(ItemType.RING); var itemIterator = TREASURE_CHEST.iterator(ItemType.RING);
@ -145,7 +145,7 @@ Use the Iterator pattern
* [How to Use Iterator?](http://www.tutorialspoint.com/java/java_using_iterator.htm) * [How to Use Iterator?](http://www.tutorialspoint.com/java/java_using_iterator.htm)
## Real world examples ## Known uses
* [java.util.Iterator](http://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html) * [java.util.Iterator](http://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html)
* [java.util.Enumeration](http://docs.oracle.com/javase/8/docs/api/java/util/Enumeration.html) * [java.util.Enumeration](http://docs.oracle.com/javase/8/docs/api/java/util/Enumeration.html)