Returns a map with the given values, indexed by keys derived from those values. In other words, each input value produces an entry in the map whose key is the result of applying keyFunction to that value. These entries appear in the same order as the input values. Example usage: <pre
(
Iterable<V> values, Function<? super V, K> keyFunction)
| 1204 | * if {@code keyFunction} produces {@code null} for any value |
| 1205 | */ |
| 1206 | @CanIgnoreReturnValue |
| 1207 | public static <K, V> ImmutableMap<K, V> uniqueIndex( |
| 1208 | Iterable<V> values, Function<? super V, K> keyFunction) { |
| 1209 | // TODO(lowasser): consider presizing the builder if values is a Collection |
| 1210 | return uniqueIndex(values.iterator(), keyFunction); |
| 1211 | } |
| 1212 | |
| 1213 | /** |
| 1214 | * Returns a map with the given {@code values}, indexed by keys derived from |
no test coverage detected