New issue report by alan.kt.wong:
It should be simple to have an interface (and accompanying implementations)
that have the same semantics as org.apache.commons.collections.IterableMap,
and org.apache.commons.collections.MapIterator. Obviously, iterable
maps in
google collections should be genericized.
The simplest implementation would enhance the JDK's HashMap, and this would
address the vast majority of use cases for an iterable map. The more
difficult ones would involve enhancements to MultiMap implementations, as
well as ConcurrentMap implementations.
Issue attributes:
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
Comment #1 by kevinb9n:
Ok, I've looked up these Apache things. I think you're asking for this:
BEFORE:
for (Map.Entry<String, Integer> entry : map.entrySet()) {
doSomethingWith(entry.getKey(), entry.getValue());
}
AFTER:
MapIterator<String, Integer> it = Maps.iterate(map);
while (it.hasNext()) {
doSomethingWith(it.getKey(), it.getValue());
}
Have I got that right?
Comment #2 by kevinb9n:
Plus I think you want an IterableMap interface that extends Map with an iterator()
method, so "Maps.iterate(map)" in the example above would become "map.iterator()".
How much of the motivation for this is supposed performance gains?