TimurMahammadov / google-collections

Automatically exported from code.google.com/p/google-collections
Apache License 2.0
0 stars 0 forks source link

Req: KeyValue iterator #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I frequently repeat code like the following:

for (key : map.keySet()) {
  V val = map.get(key);
  System.out.println(key + ": " + val)
}

It would be great if there were a KeyValue iterator for all collections,
that would do this boilerplate work:

for (keyVal : Iterators.keyValIterator(map)) { // or just map.keyValIter()
  System.out.println(keyVal.key + ": " + keyVal.val);
}

Original issue reported on code.google.com by luke.hutch on 28 Nov 2007 at 11:11

GoogleCodeExporter commented 9 years ago
Hi, Luke,

Are you thinking of some functionality beyond what is provided by 
Map.entrySet()?

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html#entrySet()

Original comment by cpov...@google.com on 28 Nov 2007 at 11:36

GoogleCodeExporter commented 9 years ago
Oh, sorry -- I wasn't even aware of that!  That's exactly what I need, I don't 
know
how I missed it.  Thanks.

I don't see an option to close this bug, please close.

Original comment by luke.hutch on 28 Nov 2007 at 11:45

GoogleCodeExporter commented 9 years ago
no problemo.

Original comment by kevin...@gmail.com on 28 Nov 2007 at 11:57