Interface Twin<T>

  • All Superinterfaces:
    java.lang.Comparable<Pair<T,​T>>, Pair<T,​T>, java.io.Serializable
    All Known Implementing Classes:
    TwinImpl

    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 Detail

      • swap

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