Class ToCollection<A,​C extends java.util.Collection<A>>

  • Type Parameters:
    A - the iterable element type
    C - the resulting collection type
    All Implemented Interfaces:
    Fn1<Fn0<C>,​Fn1<java.lang.Iterable<A>,​C>>, Fn2<Fn0<C>,​java.lang.Iterable<A>,​C>, Applicative<Fn1<java.lang.Iterable<A>,​C>,​Fn1<Fn0<C>,​?>>, Cartesian<Fn0<C>,​Fn1<java.lang.Iterable<A>,​C>,​Fn1<?,​?>>, Cocartesian<Fn0<C>,​Fn1<java.lang.Iterable<A>,​C>,​Fn1<?,​?>>, Contravariant<Fn0<C>,​Profunctor<?,​Fn1<java.lang.Iterable<A>,​C>,​Fn1<?,​?>>>, Functor<Fn1<java.lang.Iterable<A>,​C>,​Fn1<Fn0<C>,​?>>, Profunctor<Fn0<C>,​Fn1<java.lang.Iterable<A>,​C>,​Fn1<?,​?>>, Monad<Fn1<java.lang.Iterable<A>,​C>,​Fn1<Fn0<C>,​?>>, MonadReader<Fn0<C>,​Fn1<java.lang.Iterable<A>,​C>,​Fn1<Fn0<C>,​?>>, MonadRec<Fn1<java.lang.Iterable<A>,​C>,​Fn1<Fn0<C>,​?>>, MonadWriter<Fn0<C>,​Fn1<java.lang.Iterable<A>,​C>,​Fn1<Fn0<C>,​?>>

    public final class ToCollection<A,​C extends java.util.Collection<A>>
    extends java.lang.Object
    implements Fn2<Fn0<C>,​java.lang.Iterable<A>,​C>
    Given an Fn0 of some Collection C, create an instance of C and add all of the elements in the provided Iterable to the instance. Note that instances of C must support Collection.add(E) (which is to say, must not throw on invocation).
    • Field Detail

      • INSTANCE

        private static final ToCollection<?,​?> INSTANCE
    • Constructor Detail

      • ToCollection

        private ToCollection()
    • Method Detail

      • checkedApply

        public C checkedApply​(Fn0<C> cFn0,
                              java.lang.Iterable<A> as)
        Specified by:
        checkedApply in interface Fn2<Fn0<C extends java.util.Collection<A>>,​java.lang.Iterable<A>,​C extends java.util.Collection<A>>
      • toCollection

        public static <A,​C extends java.util.Collection<A>> ToCollection<A,​C> toCollection()
      • toCollection

        public static <A,​C extends java.util.Collection<A>> Fn1<java.lang.Iterable<A>,​C> toCollection​(Fn0<C> cFn0)
      • toCollection

        public static <A,​C extends java.util.Collection<A>> C toCollection​(Fn0<C> cFn0,
                                                                                 java.lang.Iterable<A> as)