Class Pair<L,​R>

  • Type Parameters:
    L - the left object type.
    R - the right object type

    @Immutable
    public class Pair<L,​R>
    extends Object
    A pair of two objects.

    This class is immutable.

    Version:
    2021-09-30
    Author:
    Alexander Martynov
    • Constructor Detail

      • Pair

        protected Pair​(L left,
                       R right)
    • Method Detail

      • of

        public static <L,​R> Pair<L,​R> of​(L left,
                                                     R right)
        Creates a new pair of two objects.
        Parameters:
        left - The left object, null if not specified.
        right - The right object, null if not specified.
        Returns:
        The pair.
      • getLeft

        public L getLeft()
        Returns the left object of this pair.
        Returns:
        The left object, null if not specified.
      • getRight

        public R getRight()
        Returns the right object of this pair.
        Returns:
        The right object, null if not specified.