Closed GoogleCodeExporter closed 8 years ago
This is named Maps.uniqueIndex(). Enjoy!
http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/col
lect/Maps.html#uniqueIndex(java.lang.Iterable,%20com.google.common.base.Function
)
Original comment by kevin...@gmail.com
on 10 Jun 2009 at 3:45
Related: I frequently miss functionality to create maps from iterables. It's
specifically annoying when I already have an iterable of immutable entry or
pair-like
objects, and you could simply reuse those. But ok, there are issues with that.
An innocent solution might be to have an index method taking an iterable and
both a
key and value function.
Map<K,V> index(Iterable<T> source, Function<T,K> keyFunction, Function<T,V>
valueFunction)
Original comment by jvdne...@gmail.com
on 11 Jun 2009 at 7:11
Original issue reported on code.google.com by
zeitlin...@gmail.com
on 10 Jun 2009 at 7:40