Package net.automatalib.common.util
Class Pair<T1,T2>
- java.lang.Object
-
- net.automatalib.common.util.string.AbstractPrintable
-
- net.automatalib.common.util.Pair<T1,T2>
-
- Type Parameters:
T1- type of the pair's first component.T2- type of the pair's second component.
- All Implemented Interfaces:
Printable
public final class Pair<T1,T2> extends AbstractPrintable
Immutable pair class.Note: this class should only be used for internal representations of tuples with value type semantics (e.g. equality, only if all components are equal).
Whenever a public interface returns an aggregation of individual objects, a separate class should be created/used that has meaningful identifiers for the individual components.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(@Nullable Object o)T1getFirst()T2getSecond()inthashCode()static <T1,T2>
Pair<T1,T2>of(T1 first, T2 second)Convenience function for creating a pair, allowing the user to omit the type parameters.voidprint(Appendable a)Outputs the current object.-
Methods inherited from class net.automatalib.common.util.string.AbstractPrintable
toString
-
-
-
-
Method Detail
-
of
public static <T1,T2> Pair<T1,T2> of(T1 first, T2 second)
Convenience function for creating a pair, allowing the user to omit the type parameters.
-
getFirst
public T1 getFirst()
-
getSecond
public T2 getSecond()
-
print
public void print(Appendable a) throws IOException
Description copied from interface:PrintableOutputs the current object.- Parameters:
a- the appendable.- Throws:
IOException- if an error occurs during appending.
-
-