code: public static <K, V> Map<K, V> indexBy(Iterable<V> groupies, Function<V, K> indexer) {
          dbc.precondition(groupies != null, "cannot index from a null iterable");
          return new IndexBy<>(indexer, new HashMapFactory<>()).apply(groupies.iterator());
      }
docs: Indexes elements from the iterable using passed function. E.g:
  <code> indexBy([1,2,3,4], id) -> {1:1, 2:2, 3:3, 4:4}</code>
  
  @param <K> the key type
  @param <V> the value type
  @param groupies elements to be indexed
  @param indexer the function used to index elements
  @return indexed elements in a map