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

## Class MagnetizeBy<A>

- java.lang.Object
- - com.jnape.palatable.lambda.functions.builtin.fn2.MagnetizeBy<A>

- Type Parameters:
    `A` - the `Iterable` element type
  All Implemented Interfaces:
    Fn1<Fn2<? super A,? super A,? extends Boolean>,Fn1<Iterable<A>,Iterable<Iterable<A>>>>, Fn2<Fn2<? super A,? super A,? extends Boolean>,Iterable<A>,Iterable<Iterable<A>>>, Applicative<Fn1<Iterable<A>,Iterable<Iterable<A>>>,Fn1<Fn2<? super A,? super A,? extends Boolean>,?>>, Cartesian<Fn2<? super A,? super A,? extends Boolean>,Fn1<Iterable<A>,Iterable<Iterable<A>>>,Fn1<?,?>>, Cocartesian<Fn2<? super A,? super A,? extends Boolean>,Fn1<Iterable<A>,Iterable<Iterable<A>>>,Fn1<?,?>>, Contravariant<Fn2<? super A,? super A,? extends Boolean>,Profunctor<?,Fn1<Iterable<A>,Iterable<Iterable<A>>>,Fn1<?,?>>>, Functor<Fn1<Iterable<A>,Iterable<Iterable<A>>>,Fn1<Fn2<? super A,? super A,? extends Boolean>,?>>, Profunctor<Fn2<? super A,? super A,? extends Boolean>,Fn1<Iterable<A>,Iterable<Iterable<A>>>,Fn1<?,?>>, Monad<Fn1<Iterable<A>,Iterable<Iterable<A>>>,Fn1<Fn2<? super A,? super A,? extends Boolean>,?>>, MonadReader<Fn2<? super A,? super A,? extends Boolean>,Fn1<Iterable<A>,Iterable<Iterable<A>>>,Fn1<Fn2<? super A,? super A,? extends Boolean>,?>>, MonadRec<Fn1<Iterable<A>,Iterable<Iterable<A>>>,Fn1<Fn2<? super A,? super A,? extends Boolean>,?>>, MonadWriter<Fn2<? super A,? super A,? extends Boolean>,Fn1<Iterable<A>,Iterable<Iterable<A>>>,Fn1<Fn2<? super A,? super A,? extends Boolean>,?>>

      public final class MagnetizeBy<A>
      extends Object
      implements Fn2<Fn2<? super A,? super A,? extends Boolean>,Iterable<A>,Iterable<Iterable<A>>>

  Given a binary predicate and an ``Iterable`<A>`, return an ``Iterable`<`Iterable`<A>>` of the contiguous groups of elements that match the predicate pairwise.

  Example: `magnetizeBy((x, y) -> x <= y, asList(1, 2, 3, 2, 2, 3, 2, 1)); // [[1, 2, 3], [2, 2, 3], [2], [1]]`

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Iterable<Iterable<A>>` | `checkedApply(Fn2<? super A,? super A,? extends Boolean> predicate, Iterable<A> as)`
    `static <A> MagnetizeBy<A>` | `magnetizeBy()`
    `static <A> Fn1<Iterable<A>,Iterable<Iterable<A>>>` | `magnetizeBy(Fn2<? super A,? super A,? extends Boolean> predicate)`
    `static <A> Iterable<Iterable<A>>` | `magnetizeBy(Fn2<? super A,? super A,? extends Boolean> predicate, Iterable<A> as)`

    - ### 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 Iterable<Iterable<A>> checkedApply(Fn2<? super A,? super A,? extends Boolean> predicate,
                                                    Iterable<A> as)

      Specified by:
        `checkedApply` in interface `Fn2<Fn2<? super A,? super A,? extends Boolean>,Iterable<A>,Iterable<Iterable<A>>>`

    - #### magnetizeBy

          public static <A> MagnetizeBy<A> magnetizeBy()

    - #### magnetizeBy

          public static <A> Fn1<Iterable<A>,Iterable<Iterable<A>>> magnetizeBy(Fn2<? super A,? super A,? extends Boolean> predicate)

    - #### magnetizeBy

          public static <A> Iterable<Iterable<A>> magnetizeBy(Fn2<? super A,? super A,? extends Boolean> predicate,
                                                              Iterable<A> as)