at.molindo.utils.data
Class Pair<A,B>

java.lang.Object
  extended by at.molindo.utils.data.Pair<A,B>
All Implemented Interfaces:
Serializable

public class Pair<A,B>
extends Object
implements Serializable

See Also:
Serialized Form

Nested Class Summary
static class Pair.PairCollectionBuilder<K,V>
           
 
Constructor Summary
Pair()
          Contructs a pair holding two null values.
Pair(A a, B b)
          Contructs a pair holding the given objects.
Pair(Map.Entry<A,B> e)
           
Pair(Pair<A,B> p)
          Contructs a pair holding the objects of the given pair.
 
Method Summary
 boolean equals(Object obj)
           
 A getFirst()
           
 A getKey()
           
 B getSecond()
           
 B getValue()
           
 int hashCode()
           
static
<T> T[]
keys(Class<T> cls, PairList<? extends T,?> c)
           
static Object[] keys(PairList<?,?> c)
           
static
<K,V> Pair<K,V>
pair()
          utility method to create pairs with implicit parameterization
static
<K,V> Pair<K,V>
pair(K key, V val)
          utility method to create pairs with implicit parameterization
static
<K,V> Pair.PairCollectionBuilder<K,V>
pairs()
           
static
<K> Pair.PairCollectionBuilder<K,K>
pairs(Class<K> kv)
           
static
<K,V> Pair.PairCollectionBuilder<K,V>
pairs(Class<K> k, Class<V> v)
           
static
<K,V> Pair.PairCollectionBuilder<K,V>
pairs(K k, V v)
           
 void setFirst(A first)
           
 void setSecond(B second)
           
static
<K,V> HashMap<K,V>
toHashMap(List<Pair<K,V>> pairs)
           
 String toString()
           
static
<T> T[]
values(Class<T> cls, PairList<?,? extends T> c)
           
static Object[] values(PairList<?,?> c)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair()
Contructs a pair holding two null values.


Pair

public Pair(A a,
            B b)
Contructs a pair holding the given objects.


Pair

public Pair(Pair<A,B> p)
Contructs a pair holding the objects of the given pair.


Pair

public Pair(Map.Entry<A,B> e)
Method Detail

toHashMap

public static <K,V> HashMap<K,V> toHashMap(List<Pair<K,V>> pairs)

keys

public static Object[] keys(PairList<?,?> c)

keys

public static <T> T[] keys(Class<T> cls,
                           PairList<? extends T,?> c)

values

public static Object[] values(PairList<?,?> c)

values

public static <T> T[] values(Class<T> cls,
                             PairList<?,? extends T> c)

pair

public static <K,V> Pair<K,V> pair(K key,
                                   V val)
utility method to create pairs with implicit parameterization

Type Parameters:
K -
V -
Parameters:
key -
val -
Returns:

pair

public static <K,V> Pair<K,V> pair()
utility method to create pairs with implicit parameterization

Type Parameters:
K -
V -
Returns:

pairs

public static <K> Pair.PairCollectionBuilder<K,K> pairs(Class<K> kv)

pairs

public static <K,V> Pair.PairCollectionBuilder<K,V> pairs(K k,
                                                          V v)

pairs

public static <K,V> Pair.PairCollectionBuilder<K,V> pairs(Class<K> k,
                                                          Class<V> v)

pairs

public static <K,V> Pair.PairCollectionBuilder<K,V> pairs()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getFirst

public A getFirst()

setFirst

public void setFirst(A first)

getSecond

public B getSecond()

setSecond

public void setSecond(B second)

getValue

public B getValue()

getKey

public A getKey()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 Molindo GmbH. All Rights Reserved.