Package it.unimi.dsi.fastutil
Interface SortedPair<K extends java.lang.Comparable<K>>
-
- Type Parameters:
K
- the type of the elements.
- All Superinterfaces:
Pair<K,K>
- All Known Subinterfaces:
ByteByteSortedPair
,CharCharSortedPair
,DoubleDoubleSortedPair
,FloatFloatSortedPair
,IntIntSortedPair
,LongLongSortedPair
,ShortShortSortedPair
- All Known Implementing Classes:
ByteByteImmutableSortedPair
,CharCharImmutableSortedPair
,DoubleDoubleImmutableSortedPair
,FloatFloatImmutableSortedPair
,IntIntImmutableSortedPair
,LongLongImmutableSortedPair
,ObjectObjectImmutableSortedPair
,ShortShortImmutableSortedPair
public interface SortedPair<K extends java.lang.Comparable<K>> extends Pair<K,K>
A pair of sorted elements.This interface strengthen
Pair
, without adding methods. It assumes that both elements of the pair are of the same type, and that they are primitive or comparable. It guarantees that the left element is smaller than or equal to the right element.Implementations of this class can be used to represent unordered pairs by canonicalization. Note that, in particular, if you build a sorted pair using a left and right element in the wrong order they will be exchanged.
-
-
Method Summary
Static Methods Modifier and Type Method Description static <K extends java.lang.Comparable<K>>
SortedPair<K>of(K l, K r)
Returns a new immutableSortedPair
with given left and right value.
-
-
-
Method Detail
-
of
static <K extends java.lang.Comparable<K>> SortedPair<K> of(K l, K r)
Returns a new immutableSortedPair
with given left and right value.Note that if
left
andright
are in the wrong order, they will be exchanged.- Parameters:
l
- the left value.r
- the right value.- Implementation Notes:
- This factory method delegates to
ObjectObjectImmutablePair.of(Object, Object)
.
-
-