Package net.dermetfan.utils
Class Pair<K,V>
java.lang.Object
net.dermetfan.utils.Pair<K,V>
- Type Parameters:
K- the type of the keyV- the type of the value
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Pair
public Pair()creates an empty pair (keyandvaluearenull) -
Pair
- Parameters:
key- thekeyvalue- thevalue
-
Pair
- Parameters:
pair- thePairto copy
-
-
Method Details
-
set
- Parameters:
pair- the Pair whichkeyandvalueto use- Returns:
- this Pair for chaining
-
set
- Parameters:
key- thekeyto setvalue- thevalueto set- Returns:
- this Pair for chaining
-
clear
public void clear()setskeyandvalueto null -
clearKey
public void clearKey()setskeynull -
clearValue
public void clearValue()setsvaluenull -
isEmpty
public boolean isEmpty()- Returns:
- if
keyorvalueis notnull
-
isFull
public boolean isFull()- Returns:
- if
keyandvalueare both notnull
-
hasKey
public boolean hasKey()- Returns:
- if
keyis not null
-
hasValue
public boolean hasValue()- Returns:
- if
valueis not null
-
swap
swaps key and value- Throws:
IllegalStateException- if the classes ofkeyandvalueare notassignablefrom each other
-
hashCode
public int hashCode() -
equals
-
toString
-
getKey
- Returns:
- the
key
-
setKey
- Parameters:
key- thekeyto set
-
getValue
- Returns:
- the
value
-
setValue
- Parameters:
value- thevalueto set
-