Package uk.ac.starlink.util
Class Pair<T>
java.lang.Object
uk.ac.starlink.util.Pair<T>
Aggregates two objects of the same type.
This utility class does not do anything clever.
- Since:
- 12 Sep 2019
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getItem1()
Returns this pair's first item.getItem2()
Returns this item's second item.int
hashCode()
static <S> Pair<S[]>
splitArray
(S[] in) Splits an array into two consituent parts.static <S> Pair<Collection<S>>
splitCollection
(Collection<S> in) Splits a collection into two constituent parts.toString()
-
Constructor Details
-
Pair
Constructor.- Parameters:
item1
- first itemitem2
- second item
-
-
Method Details
-
getItem1
Returns this pair's first item.- Returns:
- item
-
getItem2
Returns this item's second item.- Returns:
- item
-
hashCode
public int hashCode() -
equals
-
toString
-
splitCollection
Splits a collection into two constituent parts.- Parameters:
in
- input collection; unaffected on exit- Returns:
- pair of non-null collections (currently Lists), each containing about half of the input collection
-
splitArray
Splits an array into two consituent parts.- Parameters:
in
- input array; unaffected on exit- Returns:
- pair of non-null arrays, each containing about half of the input array
-