org.mapdb
Class Fun

java.lang.Object
  extended by org.mapdb.Fun

public final class Fun
extends Object

Functional stuff. Tuples, function, callback methods etc..

Author:
Jan Kotek

Nested Class Summary
static class Fun.ArrayComparator
          compares two arrays using given comparators
static interface Fun.Function0<R>
           
static interface Fun.Function1<R,A>
           
static interface Fun.Function2<R,A,B>
           
static class Fun.Tuple2<A,B>
           
static class Fun.Tuple2Comparator<A,B>
           
static class Fun.Tuple3<A,B,C>
           
static class Fun.Tuple3Comparator<A,B,C>
           
static class Fun.Tuple4<A,B,C,D>
           
static class Fun.Tuple4Comparator<A,B,C,D>
           
static class Fun.Tuple5<A,B,C,D,E>
           
static class Fun.Tuple5Comparator<A,B,C,D,E>
           
static class Fun.Tuple6<A,B,C,D,E,F>
           
static class Fun.Tuple6Comparator<A,B,C,D,E,F>
           
 
Field Summary
static Comparator<byte[]> BYTE_ARRAY_COMPARATOR
           
static Comparator<char[]> CHAR_ARRAY_COMPARATOR
           
static Comparator<Object[]> COMPARABLE_ARRAY_COMPARATOR
          Compares two arrays which contains comparable elements
static Comparator COMPARATOR
           
static Comparator<double[]> DOUBLE_ARRAY_COMPARATOR
           
static Iterator EMPTY_ITERATOR
          empty iterator (note: Collections.EMPTY_ITERATOR is Java 7 specific and should not be used)
static Object HI
          positive infinity object.
static Comparator<int[]> INT_ARRAY_COMPARATOR
           
static Comparator<long[]> LONG_ARRAY_COMPARATOR
           
static Comparator<Comparable> REVERSE_COMPARATOR
           
static Comparator<Fun.Tuple2> TUPLE2_COMPARATOR
           
static Comparator<Fun.Tuple3> TUPLE3_COMPARATOR
           
static Comparator<Fun.Tuple4> TUPLE4_COMPARATOR
           
static Comparator<Fun.Tuple5> TUPLE5_COMPARATOR
           
static Comparator<Fun.Tuple6> TUPLE6_COMPARATOR
           
 
Method Summary
static boolean eq(Object a, Object b)
          returns true if all elements are equal, works with nulls
static
<K,V> Fun.Function1<K,Fun.Tuple2<K,V>>
extractKey()
           
static
<K> Fun.Function1<K,K>
extractNoTransform()
           
static
<K,V> Fun.Function1<V,Fun.Tuple2<K,V>>
extractValue()
           
static
<K2,K1> Iterable<K1>
filter(NavigableSet<Fun.Tuple2<K2,K1>> secondaryKeys, K2 secondaryKey)
          Find all Primary Keys associated with Secondary Key.
static
<K2,K1> Iterable<K1>
filter(NavigableSet<Fun.Tuple2<K2,K1>> secondaryKeys, K2 lo, boolean loInc, K2 hi, boolean hiInc)
           
static
<A,B,C> Iterable<C>
filter(NavigableSet<Fun.Tuple3<A,B,C>> secondaryKeys, A a, B b)
           
static
<A,B,C,D> Iterable<D>
filter(NavigableSet<Fun.Tuple4<A,B,C,D>> secondaryKeys, A a, B b, C c)
           
static
<A> A
HI()
          autocast version of `HI`
static
<A,B> Fun.Tuple2<A,B>
t2(A a, B b)
           
static
<A,B,C> Fun.Tuple3<A,B,C>
t3(A a, B b, C c)
           
static
<A,B,C,D> Fun.Tuple4<A,B,C,D>
t4(A a, B b, C c, D d)
           
static
<A,B,C,D,E>
Fun.Tuple5<A,B,C,D,E>
t5(A a, B b, C c, D d, E e)
           
static
<A,B,C,D,E,F>
Fun.Tuple6<A,B,C,D,E,F>
t6(A a, B b, C c, D d, E e, F f)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPARATOR

public static final Comparator COMPARATOR

REVERSE_COMPARATOR

public static final Comparator<Comparable> REVERSE_COMPARATOR

EMPTY_ITERATOR

public static final Iterator EMPTY_ITERATOR
empty iterator (note: Collections.EMPTY_ITERATOR is Java 7 specific and should not be used)


TUPLE2_COMPARATOR

public static final Comparator<Fun.Tuple2> TUPLE2_COMPARATOR

TUPLE3_COMPARATOR

public static final Comparator<Fun.Tuple3> TUPLE3_COMPARATOR

TUPLE4_COMPARATOR

public static final Comparator<Fun.Tuple4> TUPLE4_COMPARATOR

TUPLE5_COMPARATOR

public static final Comparator<Fun.Tuple5> TUPLE5_COMPARATOR

TUPLE6_COMPARATOR

public static final Comparator<Fun.Tuple6> TUPLE6_COMPARATOR

HI

public static final Object HI
positive infinity object. Is larger than anything else. Used in tuple comparators. Negative infinity is represented by 'null'


BYTE_ARRAY_COMPARATOR

public static final Comparator<byte[]> BYTE_ARRAY_COMPARATOR

CHAR_ARRAY_COMPARATOR

public static final Comparator<char[]> CHAR_ARRAY_COMPARATOR

INT_ARRAY_COMPARATOR

public static final Comparator<int[]> INT_ARRAY_COMPARATOR

LONG_ARRAY_COMPARATOR

public static final Comparator<long[]> LONG_ARRAY_COMPARATOR

DOUBLE_ARRAY_COMPARATOR

public static final Comparator<double[]> DOUBLE_ARRAY_COMPARATOR

COMPARABLE_ARRAY_COMPARATOR

public static final Comparator<Object[]> COMPARABLE_ARRAY_COMPARATOR
Compares two arrays which contains comparable elements

Method Detail

HI

public static <A> A HI()
autocast version of `HI`


t2

public static <A,B> Fun.Tuple2<A,B> t2(A a,
                                       B b)

t3

public static <A,B,C> Fun.Tuple3<A,B,C> t3(A a,
                                           B b,
                                           C c)

t4

public static <A,B,C,D> Fun.Tuple4<A,B,C,D> t4(A a,
                                               B b,
                                               C c,
                                               D d)

t5

public static <A,B,C,D,E> Fun.Tuple5<A,B,C,D,E> t5(A a,
                                                   B b,
                                                   C c,
                                                   D d,
                                                   E e)

t6

public static <A,B,C,D,E,F> Fun.Tuple6<A,B,C,D,E,F> t6(A a,
                                                       B b,
                                                       C c,
                                                       D d,
                                                       E e,
                                                       F f)

eq

public static boolean eq(Object a,
                         Object b)
returns true if all elements are equal, works with nulls


extractKey

public static <K,V> Fun.Function1<K,Fun.Tuple2<K,V>> extractKey()

extractValue

public static <K,V> Fun.Function1<V,Fun.Tuple2<K,V>> extractValue()

extractNoTransform

public static <K> Fun.Function1<K,K> extractNoTransform()

filter

public static <K2,K1> Iterable<K1> filter(NavigableSet<Fun.Tuple2<K2,K1>> secondaryKeys,
                                          K2 secondaryKey)
Find all Primary Keys associated with Secondary Key. This is useful companion to Bind.mapInverse(org.mapdb.Bind.MapWithModificationListener, java.util.Set) and Bind.secondaryKey(org.mapdb.Bind.MapWithModificationListener, java.util.Set, org.mapdb.Fun.Function2) It can by also used to find values from 'MultiMap'.

Parameters:
secondaryKeys - Secondary Set or 'MultiMap' to find values in
secondaryKey - key to look from
Returns:
all keys where primary value equals to `secondaryKey`

filter

public static <K2,K1> Iterable<K1> filter(NavigableSet<Fun.Tuple2<K2,K1>> secondaryKeys,
                                          K2 lo,
                                          boolean loInc,
                                          K2 hi,
                                          boolean hiInc)

filter

public static <A,B,C> Iterable<C> filter(NavigableSet<Fun.Tuple3<A,B,C>> secondaryKeys,
                                         A a,
                                         B b)

filter

public static <A,B,C,D> Iterable<D> filter(NavigableSet<Fun.Tuple4<A,B,C,D>> secondaryKeys,
                                           A a,
                                           B b,
                                           C c)


Copyright © 2014. All Rights Reserved.