Class SortBy<A,​B extends java.lang.Comparable<B>>

  • Type Parameters:
    A - the input Iterable and output List element type
    B - the mapped Comparable type
    All Implemented Interfaces:
    Fn1<Fn1<? super A,​? extends B>,​Fn1<java.lang.Iterable<A>,​java.util.List<A>>>, Fn2<Fn1<? super A,​? extends B>,​java.lang.Iterable<A>,​java.util.List<A>>, Applicative<Fn1<java.lang.Iterable<A>,​java.util.List<A>>,​Fn1<Fn1<? super A,​? extends B>,​?>>, Cartesian<Fn1<? super A,​? extends B>,​Fn1<java.lang.Iterable<A>,​java.util.List<A>>,​Fn1<?,​?>>, Cocartesian<Fn1<? super A,​? extends B>,​Fn1<java.lang.Iterable<A>,​java.util.List<A>>,​Fn1<?,​?>>, Contravariant<Fn1<? super A,​? extends B>,​Profunctor<?,​Fn1<java.lang.Iterable<A>,​java.util.List<A>>,​Fn1<?,​?>>>, Functor<Fn1<java.lang.Iterable<A>,​java.util.List<A>>,​Fn1<Fn1<? super A,​? extends B>,​?>>, Profunctor<Fn1<? super A,​? extends B>,​Fn1<java.lang.Iterable<A>,​java.util.List<A>>,​Fn1<?,​?>>, Monad<Fn1<java.lang.Iterable<A>,​java.util.List<A>>,​Fn1<Fn1<? super A,​? extends B>,​?>>, MonadReader<Fn1<? super A,​? extends B>,​Fn1<java.lang.Iterable<A>,​java.util.List<A>>,​Fn1<Fn1<? super A,​? extends B>,​?>>, MonadRec<Fn1<java.lang.Iterable<A>,​java.util.List<A>>,​Fn1<Fn1<? super A,​? extends B>,​?>>, MonadWriter<Fn1<? super A,​? extends B>,​Fn1<java.lang.Iterable<A>,​java.util.List<A>>,​Fn1<Fn1<? super A,​? extends B>,​?>>

    public final class SortBy<A,​B extends java.lang.Comparable<B>>
    extends java.lang.Object
    implements Fn2<Fn1<? super A,​? extends B>,​java.lang.Iterable<A>,​java.util.List<A>>
    Given an Iterable and some mapping function from the Iterable element type to some Comparable type, produce a sorted List of the original elements based on sorting applied to the result of the mapping function. Note that this is both eager and monolithic.
    See Also:
    Sort, SortWith
    • Field Detail

      • INSTANCE

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

      • SortBy

        private SortBy()
    • Method Detail

      • checkedApply

        public java.util.List<A> checkedApply​(Fn1<? super A,​? extends B> fn,
                                              java.lang.Iterable<A> as)
        Specified by:
        checkedApply in interface Fn2<Fn1<? super A,​? extends B extends java.lang.Comparable<B>>,​java.lang.Iterable<A>,​java.util.List<A>>
      • sortBy

        public static <A,​B extends java.lang.Comparable<B>> SortBy<A,​B> sortBy()
      • sortBy

        public static <A,​B extends java.lang.Comparable<B>> Fn1<java.lang.Iterable<A>,​java.util.List<A>> sortBy​(Fn1<? super A,​? extends B> fn)
      • sortBy

        public static <A,​B extends java.lang.Comparable<B>> java.util.List<A> sortBy​(Fn1<? super A,​? extends B> fn,
                                                                                           java.lang.Iterable<A> as)