Closed GoogleCodeExporter closed 9 years ago
I think you're saying that you'd like values() and/or entries() to return
Lists, yes?
Original comment by kevin...@gmail.com
on 5 Nov 2009 at 1:09
I believe we also had idle thoughts of making ImmutableMap.values() return
ImmutableList. The same would be true of ImmutableMap.entrySet(), except that
it's a
Set, so it can't be a List. Resolving issue 229 (ImmutableCollection.asList() /
ImmutableList.copyOf(nonListImmutableCollection) doesn't make a copy) would be a
solution for the ImmutableMap/ImmutableMultimap/etc. case.
Original comment by cpov...@google.com
on 5 Nov 2009 at 1:39
If performance isn't a concern, you can retrieve elements by position with the
command
Iterables.get(multimap.entries(), position);
For better performance, you could say
List<Map.Entry<K, V>> entryList = Lists.newArrayList(multimap.entries());
Then you could easily access arbitrary entries and call Entry.setValue().
However,
adding or removing records from the multimap wouldn't change the list, and vice
versa.
Having LinkedListMultimap.entries() return a List makes sense conceptually, but
there
may not be enough demand to justify that change.
Chris, ImmutableMap can't have a values() returning an ImmutableList because its
subclass ImmutableBiMap has a values() method returning an ImmutableSet.
Original comment by jared.l....@gmail.com
on 5 Nov 2009 at 2:10
This issue has been moved to the Guava project (keeping the same id number).
Simply replace 'google-collections' with 'guava-libraries' in your address
bar and it should take you there.
Original comment by kevinb@google.com
on 5 Jan 2010 at 11:09
Original issue reported on code.google.com by
ram.6...@gmail.com
on 3 Nov 2009 at 6:52