Class Pair<T1,​T2>

  • Type Parameters:
    T1 - type of the first object in the pair
    T2 - type of the second object in the pair
    Direct Known Subclasses:
    LangBearingString

    public class Pair<T1,​T2>
    extends Object
    Container for a pair of objects.
    • Field Detail

      • first

        private T1 first
        First object in pair.
      • second

        private T2 second
        Second object in pair.
    • Constructor Detail

      • Pair

        public Pair()
        Constructor.
      • Pair

        public Pair​(@Nullable
                    T1 newFirst,
                    @Nullable
                    T2 newSecond)
        Constructor.
        Parameters:
        newFirst - first object in the pair
        newSecond - second object in the pair
      • Pair

        public Pair​(@Nonnull
                    Pair<? extends T1,​? extends T2> pair)
        Copy constructor.
        Parameters:
        pair - pair to be copied
    • Method Detail

      • getFirst

        @Nullable
        public T1 getFirst()
        Gets the first object in the pair.
        Returns:
        first object in the pair
      • setFirst

        public void setFirst​(@Nullable
                             T1 newFirst)
        Sets the first object in the pair.
        Parameters:
        newFirst - first object in the pair
      • getSecond

        @Nullable
        public T2 getSecond()
        Gets the second object in the pair.
        Returns:
        second object in the pair
      • setSecond

        public void setSecond​(@Nullable
                              T2 newSecond)
        Sets the second object in the pair.
        Parameters:
        newSecond - second object in the pair
      • equals

        public boolean equals​(@Nullable
                              Object o)
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object