Class Pair<A,​B>

  • Type Parameters:
    A - Type of the first element
    B - Type of the second element

    @ThreadSafe
    public class Pair<A,​B>
    extends java.lang.Object
    Convenience class for returning multiple objects from methods.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private A a  
      private B b  
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair​(A a, B b)
      Create a pair and store two objects.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      A getA()
      Returns the first stored object.
      B getB()
      Returns the second stored object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • a

        private final A a
      • b

        private final B b
    • Constructor Detail

      • Pair

        public Pair​(A a,
                    B b)
        Create a pair and store two objects.
        Parameters:
        a - the first object to store
        b - the second object to store
    • Method Detail

      • getA

        public final A getA()
        Returns the first stored object.
        Returns:
        first object stored
      • getB

        public final B getB()
        Returns the second stored object.
        Returns:
        second object stored