Issue 90 in google-collections: Iterable maps

0 views
Skip to first unread message

codesite...@google.com

unread,
Jul 8, 2008, 11:07:51 AM7/8/08
to google-coll...@googlegroups.com
Issue 90: Iterable maps
http://code.google.com/p/google-collections/issues/detail?id=90

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

codesite...@google.com

unread,
Jul 8, 2008, 11:50:08 AM7/8/08
to google-coll...@googlegroups.com

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?

codesite...@google.com

unread,
Jul 8, 2008, 12:09:13 PM7/8/08
to google-coll...@googlegroups.com

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?

Reply all
Reply to author
Forward
0 new messages