Package org.tweetyproject.commons.util
Class Pair<E,F>
java.lang.Object
org.tweetyproject.commons.util.Pair<E,F>
- Type Parameters:
E- the type of the first elementF- the type of the second element
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Division
This class implements a simple pair of elements.
- Author:
- Matthias Thimm, Bastian Wolf
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetFirst()returns the first element of this pairreturns the second element of this pairinthashCode()voidsets the first element of this pairvoidsets the second element of this pairtoString()returns a string representation of a pair as "(obj1, obj2)"
-
Constructor Details
-
Pair
public Pair()Initializes an empty pair. -
Pair
Initializes the elements of this pair with the given parameters- Parameters:
obj1- the first element of this pairobj2- the second element of this pair
-
-
Method Details
-
getFirst
returns the first element of this pair- Returns:
- the first element of this pair
-
setFirst
sets the first element of this pair- Parameters:
obj1- an object of type E
-
getSecond
returns the second element of this pair- Returns:
- the second element of this pair
-
setSecond
sets the second element of this pair- Parameters:
obj2- an object of type F
-
hashCode
public int hashCode() -
equals
-
toString
returns a string representation of a pair as "(obj1, obj2)"
-