Class Occurrences<A>

  • Type Parameters:
    A - the Iterable element type
    All Implemented Interfaces:
    Fn1<java.lang.Iterable<A>,​java.util.Map<A,​java.lang.Long>>, Applicative<java.util.Map<A,​java.lang.Long>,​Fn1<java.lang.Iterable<A>,​?>>, Cartesian<java.lang.Iterable<A>,​java.util.Map<A,​java.lang.Long>,​Fn1<?,​?>>, Cocartesian<java.lang.Iterable<A>,​java.util.Map<A,​java.lang.Long>,​Fn1<?,​?>>, Contravariant<java.lang.Iterable<A>,​Profunctor<?,​java.util.Map<A,​java.lang.Long>,​Fn1<?,​?>>>, Functor<java.util.Map<A,​java.lang.Long>,​Fn1<java.lang.Iterable<A>,​?>>, Profunctor<java.lang.Iterable<A>,​java.util.Map<A,​java.lang.Long>,​Fn1<?,​?>>, Monad<java.util.Map<A,​java.lang.Long>,​Fn1<java.lang.Iterable<A>,​?>>, MonadReader<java.lang.Iterable<A>,​java.util.Map<A,​java.lang.Long>,​Fn1<java.lang.Iterable<A>,​?>>, MonadRec<java.util.Map<A,​java.lang.Long>,​Fn1<java.lang.Iterable<A>,​?>>, MonadWriter<java.lang.Iterable<A>,​java.util.Map<A,​java.lang.Long>,​Fn1<java.lang.Iterable<A>,​?>>

    public final class Occurrences<A>
    extends java.lang.Object
    implements Fn1<java.lang.Iterable<A>,​java.util.Map<A,​java.lang.Long>>
    Given an Iterable<A>, return a Map<A, Long> representing each unique element in the Iterable paired with its number of occurrences.
    • Field Detail

      • INSTANCE

        private static final Occurrences<?> INSTANCE
    • Constructor Detail

      • Occurrences

        private Occurrences()
    • Method Detail

      • checkedApply

        public java.util.Map<A,​java.lang.Long> checkedApply​(java.lang.Iterable<A> as)
        Description copied from interface: Fn1
        Invoke this function with the given argument, potentially throwing any Throwable.
        Specified by:
        checkedApply in interface Fn1<java.lang.Iterable<A>,​java.util.Map<A,​java.lang.Long>>
        Parameters:
        as - the argument
        Returns:
        the result of the function application
      • occurrences

        public static <A> Occurrences<A> occurrences()
      • occurrences

        public static <A> java.util.Map<A,​java.lang.Long> occurrences​(java.lang.Iterable<A> as)