com.jnape.palatable.lambda.functions.builtin.fn2

## Class GroupBy<K,V>

- java.lang.Object
- - com.jnape.palatable.lambda.functions.builtin.fn2.GroupBy<K,V>

- Type Parameters:
    `K` - the Map key type
    `V` - the Map value type
  All Implemented Interfaces:
    Fn1<Fn1<? super V,? extends K>,Fn1<Iterable<V>,Map<K,List<V>>>>, Fn2<Fn1<? super V,? extends K>,Iterable<V>,Map<K,List<V>>>, Applicative<Fn1<Iterable<V>,Map<K,List<V>>>,Fn1<Fn1<? super V,? extends K>,?>>, Cartesian<Fn1<? super V,? extends K>,Fn1<Iterable<V>,Map<K,List<V>>>,Fn1<?,?>>, Cocartesian<Fn1<? super V,? extends K>,Fn1<Iterable<V>,Map<K,List<V>>>,Fn1<?,?>>, Contravariant<Fn1<? super V,? extends K>,Profunctor<?,Fn1<Iterable<V>,Map<K,List<V>>>,Fn1<?,?>>>, Functor<Fn1<Iterable<V>,Map<K,List<V>>>,Fn1<Fn1<? super V,? extends K>,?>>, Profunctor<Fn1<? super V,? extends K>,Fn1<Iterable<V>,Map<K,List<V>>>,Fn1<?,?>>, Monad<Fn1<Iterable<V>,Map<K,List<V>>>,Fn1<Fn1<? super V,? extends K>,?>>, MonadReader<Fn1<? super V,? extends K>,Fn1<Iterable<V>,Map<K,List<V>>>,Fn1<Fn1<? super V,? extends K>,?>>, MonadRec<Fn1<Iterable<V>,Map<K,List<V>>>,Fn1<Fn1<? super V,? extends K>,?>>, MonadWriter<Fn1<? super V,? extends K>,Fn1<Iterable<V>,Map<K,List<V>>>,Fn1<Fn1<? super V,? extends K>,?>>

      public final class GroupBy<K,V>
      extends Object
      implements Fn2<Fn1<? super V,? extends K>,Iterable<V>,Map<K,List<V>>>

  Given an `Iterable<V>` `vs` and a key function `V -> K` `f`, fold `vs` into a `Map<K, List<V>>` by applying `f` to each element of `vs`, retaining values that map to the same key in a list, in the order they were iterated in.
  See Also:
    `InGroupsOf`

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Map<K,List<V>>` | `checkedApply(Fn1<? super V,? extends K> keyFn, Iterable<V> vs)`
    `static <K,V> GroupBy<K,V>` | `groupBy()`
    `static <K,V> Fn1<Iterable<V>,Map<K,List<V>>>` | `groupBy(Fn1<? super V,? extends K> keyFn)`
    `static <K,V> Map<K,List<V>>` | `groupBy(Fn1<? super V,? extends K> keyFn, Iterable<V> vs)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.jnape.palatable.lambda.functions.Fn2

      `apply, apply, checkedApply, compose, contraMap, curried, curry, diMapL, discardR, flip, fn2, fromBiFunction, toBiFunction, uncurry, widen`

    - ### Methods inherited from interface com.jnape.palatable.lambda.functions.Fn1

      `andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, fn1, fromFunction, lazyZip, listens, local, pure, pureFn1, thunk, toFunction, trampolineM, zip, zip`

    - ### Methods inherited from interface com.jnape.palatable.lambda.monad.Monad

      `join`

    - ### Methods inherited from interface com.jnape.palatable.lambda.functor.Functor

      `coerce`

- - ### Method Detail

    - #### checkedApply

          public Map<K,List<V>> checkedApply(Fn1<? super V,? extends K> keyFn,
                                             Iterable<V> vs)

      Specified by:
        `checkedApply` in interface `Fn2<Fn1<? super V,? extends K>,Iterable<V>,Map<K,List<V>>>`

    - #### groupBy

          public static <K,V> GroupBy<K,V> groupBy()

    - #### groupBy

          public static <K,V> Fn1<Iterable<V>,Map<K,List<V>>> groupBy(Fn1<? super V,? extends K> keyFn)

    - #### groupBy

          public static <K,V> Map<K,List<V>> groupBy(Fn1<? super V,? extends K> keyFn,
                                                     Iterable<V> vs)