code: public static <K, V, M extends Map<K, V>> Map<K, V> indexBy(Iterator<V> groupies, Function<V, K> indexer, Supplier<M> mapProvider) {
          return new IndexBy<>(indexer, mapProvider).apply(groupies);
      }
docs: Indexes elements from the iterator 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 <M> the map type
  @param groupies elements to be indexed
  @param indexer the function used to index elements
  @param mapProvider a supplier used to create the resulting map
  @return indexed elements in a map