code: public static <T> Func1<Iterable<T>, SparseArray<T>> toSparseArray(final Func1<T, Integer> itemToKey, final int initialCapacity) {
          return new Func1<Iterable<T>, SparseArray<T>>() {
              @Override
              public SparseArray<T> call(Iterable<T> iterable) {
                  SparseArray<T> array = new SparseArray<>(initialCapacity);
                  for (T value : iterable)
                      array.put(itemToKey.call(value), value);
                  return array;
              }
          };
      }
docs: Returns a method that can be used with {@link solid.stream.Stream#collect(Func1)}
  to convert a stream into a {@link SparseArray}.
  <p/>
  Use this method instead of {@link #toSparseArray(Func1)}} for better performance on
  streams that can have more than 10 items.
  
  @param <T>             a type of stream items.
  @param itemToKey       a method that should return a key for an item.
  @param initialCapacity initial capacity on the sparse array.
  @return a method that converts an iterable into a {@link SparseArray}.