Class Occurrences<A>
- java.lang.Object
-
- com.jnape.palatable.lambda.functions.builtin.fn1.Occurrences<A>
-
- Type Parameters:
A- theIterableelement 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, return aIterable<A>representing each unique element in theMap<A, Long>Iterablepaired with its number of occurrences.
-
-
Field Summary
Fields Modifier and Type Field Description private static Occurrences<?>INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateOccurrences()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<A,java.lang.Long>checkedApply(java.lang.Iterable<A> as)Invoke this function with the given argument, potentially throwing anyThrowable.static <A> Occurrences<A>occurrences()static <A> java.util.Map<A,java.lang.Long>occurrences(java.lang.Iterable<A> as)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
INSTANCE
private static final Occurrences<?> INSTANCE
-
-
Method Detail
-
checkedApply
public java.util.Map<A,java.lang.Long> checkedApply(java.lang.Iterable<A> as)
Description copied from interface:Fn1Invoke this function with the given argument, potentially throwing anyThrowable.- Specified by:
checkedApplyin interfaceFn1<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)
-
-