MCPcopy Index your code
hub / github.com/antlr/codebuff / uniqueIndex

Method uniqueIndex

corpus/java/training/guava/collect/Maps.java:1206–1211  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

uniqueIndexMethod · 0.95

Calls 9

builderMethod · 0.95
iteratorMethod · 0.65
nextMethod · 0.65
putMethod · 0.65
applyMethod · 0.65
checkNotNullMethod · 0.45
hasNextMethod · 0.45
buildMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected