Class MutablePair<L,​R>

  • Type Parameters:
    L - Type of 'left' object to be held
    R - Type of 'right' object to be held

    public class MutablePair<L,​R>
    extends Pair<L,​R>
    A special type of Pair which allows the stored references to be updated after creation. Note that stored references are not volatile or synchronized, so thread access must be guarded in synchronization.
    Since:
    4.4.0
    • Constructor Detail

      • MutablePair

        public MutablePair()
        Constructs a new mutable pair with the left and right references defaulted to be null.
      • MutablePair

        public MutablePair​(L left,
                           R right)
        Constructs a new mutable pair, providing the left and right objects to be held.
        Parameters:
        left - Left reference
        right - Right reference
    • Method Detail

      • setLeft

        public void setLeft​(L left)
        Update the left reference with the provided object.
        Parameters:
        left - New reference to be used for the left of the pair
      • setRight

        public void setRight​(R right)
        Update the right reference with the provided object.
        Parameters:
        right - New reference to be used for the right of the pair