Interface Twin<T>

All Superinterfaces:
Comparable<Pair<T,​T>>, Pair<T,​T>, Serializable

public interface Twin<T>
extends Pair<T,​T>
A Twin is a Pair where both elements have the same type. An instance of this interface can be created by calling Tuples.twin(Object, Object).
  • Method Summary

    Modifier and Type Method Description
    Twin<T> swap()
    Method used to swap the elements of pair.

    Methods inherited from interface java.lang.Comparable


    Methods inherited from interface org.eclipse.collections.api.tuple.Pair

    getOne, getTwo, put, toEntry
  • Method Details

    • swap

      Twin<T> swap()
      Description copied from interface: Pair
      Method used to swap the elements of pair.
       Pair<String, Integer> pair = Tuples.pair("One", 1);
       Pair<Integer, String> swappedPair = pair.swap();
      Specified by:
      swap in interface Pair<T,​T>