org.mapdb
Class Fun
- java.lang.Object
-
- org.mapdb.Fun
-
public final class Fun extends java.lang.ObjectFunctional stuff. Tuples, function, callback methods etc..
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classFun.ArrayComparatorcompares two arrays using given comparatorsstatic interfaceFun.Function0<R>function which takes no argument and returns one valuestatic interfaceFun.Function1<R,A>function which takes one argument and returns one valuestatic interfaceFun.Function1Int<R>function which takes one int argument and returns one valuestatic interfaceFun.Function2<R,A,B>function which takes two argument and returns one valuestatic classFun.Pair<A,B>static interfaceFun.RecordCondition<A>decides if some action should be executed on an record
-
Field Summary
Fields Modifier and Type Field and Description static java.util.Comparator<byte[]>BYTE_ARRAY_COMPARATORstatic java.util.Comparator<char[]>CHAR_ARRAY_COMPARATORstatic java.util.Comparator<java.lang.Object[]>COMPARABLE_ARRAY_COMPARATORCompares two arrays which contains comparable elementsstatic java.util.ComparatorCOMPARATORstatic java.util.Comparator<double[]>DOUBLE_ARRAY_COMPARATORstatic java.util.IteratorEMPTY_ITERATORstatic java.util.Comparator<int[]>INT_ARRAY_COMPARATORstatic java.util.Comparator<long[]>LONG_ARRAY_COMPARATORstatic java.lang.ObjectPLACEHOLDERplace holder for some stuff in futurestatic Fun.RecordConditionRECORD_ALWAYS_TRUErecord condition which always returns truestatic java.util.ComparatorREVERSE_COMPARATOR
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static <T> java.util.Comparator<T>comparator()A utility method for getting a type-safe Comparator, it provides type-inference help.static intcompareInt(int x, int y)static intcompareLong(long x, long y)static <T> java.util.Iterator<T>emptyIterator()static booleaneq(java.lang.Object a, java.lang.Object b)returns true if all elements are equal, works with nullsstatic <K,V> Fun.Function1<K,Fun.Pair<K,V>>extractKey()static <K,V> Fun.Function1<K,java.util.Map.Entry<K,V>>extractMapEntryKey()static <K,V> Fun.Function1<V,java.util.Map.Entry<K,V>>extractMapEntryValue()static <K> Fun.Function1<K,K>extractNoTransform()returns function which always returns the value itself without transformationstatic <K,V> Fun.Function1<V,Fun.Pair<K,V>>extractValue()static java.lang.Iterable<java.lang.Object[]>filter(java.util.NavigableSet<java.lang.Object[]> set, java.lang.Object... keys)TODO document tuples Find all Primary Keys associated with Secondary Key.static <T> java.util.Comparator<T>reverseComparator()A utility method for getting a type-safe reversed Comparator (the negation ofcomparator()).static longroundUp(long number, long roundUpToMultipleOf)
-
-
-
Field Detail
-
PLACEHOLDER
public static final java.lang.Object PLACEHOLDER
place holder for some stuff in future
-
COMPARATOR
public static final java.util.Comparator COMPARATOR
-
REVERSE_COMPARATOR
public static final java.util.Comparator REVERSE_COMPARATOR
-
EMPTY_ITERATOR
public static final java.util.Iterator EMPTY_ITERATOR
-
BYTE_ARRAY_COMPARATOR
public static final java.util.Comparator<byte[]> BYTE_ARRAY_COMPARATOR
-
CHAR_ARRAY_COMPARATOR
public static final java.util.Comparator<char[]> CHAR_ARRAY_COMPARATOR
-
INT_ARRAY_COMPARATOR
public static final java.util.Comparator<int[]> INT_ARRAY_COMPARATOR
-
LONG_ARRAY_COMPARATOR
public static final java.util.Comparator<long[]> LONG_ARRAY_COMPARATOR
-
DOUBLE_ARRAY_COMPARATOR
public static final java.util.Comparator<double[]> DOUBLE_ARRAY_COMPARATOR
-
COMPARABLE_ARRAY_COMPARATOR
public static final java.util.Comparator<java.lang.Object[]> COMPARABLE_ARRAY_COMPARATOR
Compares two arrays which contains comparable elements
-
RECORD_ALWAYS_TRUE
public static final Fun.RecordCondition RECORD_ALWAYS_TRUE
record condition which always returns true
-
-
Method Detail
-
comparator
public static <T> java.util.Comparator<T> comparator()
A utility method for getting a type-safe Comparator, it provides type-inference help. Use this method instead ofCOMPARATORin order to insure type-safety ex:Comparator<Integer> comparator = getComparator();- Returns:
- comparator
-
reverseComparator
public static <T> java.util.Comparator<T> reverseComparator()
A utility method for getting a type-safe reversed Comparator (the negation ofcomparator()). Use this method instead ofREVERSE_COMPARATORin order to insure type-safety ex:Comparator<Integer> comparator = getReversedComparator();- Returns:
- comparator
-
emptyIterator
public static <T> java.util.Iterator<T> emptyIterator()
-
eq
public static boolean eq(java.lang.Object a, java.lang.Object b)returns true if all elements are equal, works with nulls
-
roundUp
public static long roundUp(long number, long roundUpToMultipleOf)
-
extractKey
public static <K,V> Fun.Function1<K,Fun.Pair<K,V>> extractKey()
-
extractValue
public static <K,V> Fun.Function1<V,Fun.Pair<K,V>> extractValue()
-
extractMapEntryKey
public static <K,V> Fun.Function1<K,java.util.Map.Entry<K,V>> extractMapEntryKey()
-
extractMapEntryValue
public static <K,V> Fun.Function1<V,java.util.Map.Entry<K,V>> extractMapEntryValue()
-
extractNoTransform
public static <K> Fun.Function1<K,K> extractNoTransform()
returns function which always returns the value itself without transformation
-
compareInt
public static int compareInt(int x, int y)
-
compareLong
public static int compareLong(long x, long y)
-
filter
public static java.lang.Iterable<java.lang.Object[]> filter(java.util.NavigableSet<java.lang.Object[]> set, java.lang.Object... keys)TODO document tuples Find all Primary Keys associated with Secondary Key. This is useful companion toBind.mapInverse(org.mapdb.Bind.MapWithModificationListener, java.util.Set)andBind.secondaryKey(org.mapdb.Bind.MapWithModificationListener, java.util.Set, org.mapdb.Fun.Function2)It can by also used to find values from 'MultiMap'.- Parameters:
set- Set or 'MultiMap' to find values inkeys- key to look from- Returns:
- all keys where primary value equals to
secondaryKey
-
-
DataMelt 3.0 © DataMelt by jWork.ORG