Class TwinImpl<T>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Pair<T,​T>>, Pair<T,​T>, Twin<T>

    final class TwinImpl<T>
    extends PairImpl<T,​T>
    implements Twin<T>
    A TwinImpl is a PairImpl that has the same type for both items. This is a convenience class
    • Constructor Detail

      • TwinImpl

        TwinImpl​(T newOne,
                 T newTwo)
    • Method Detail

      • swap

        public TwinImpl<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>
        Specified by:
        swap in interface Twin<T>
        Overrides:
        swap in class PairImpl<T,​T>