|
|
|
|
|
by laureny
4665 days ago
|
|
> Explicit iterators are really only noise for the "natural" iterator, i.e. in order iteration over an array. Not really, they are really noise in a lot of situations. Right now, I can only think of one case where they are necessary: lazy traversal. Either the collection is huge or each element is expensive to materialize, so you want to do that one at a time. Iterators are perfect for this. They are unnecessary in all other cases. For example, for your (key, value) example: for (Entry<String, String> entry: map.entrySet()) { ... }
Go exposes too many implementation details to my taste. |
|