Class Pair


  • public class Pair
    extends java.lang.Object
    A simple read-only wrapper-class for holding two values. This is used to return results from the coercion functions, since they take two inputs and must coerce them into being the same types.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.Object value1
      The first value of the pair.
      java.lang.Object value2
      The second value of the pair.
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair​(java.lang.Object obj1, java.lang.Object obj2)
      Construct a new pair using the specified values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Pair swap()
      Returns a new Pair object with the values swapped.
      • Methods inherited from class java.lang.Object

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

      • value1

        public final java.lang.Object value1
        The first value of the pair.
      • value2

        public final java.lang.Object value2
        The second value of the pair.
    • Constructor Detail

      • Pair

        public Pair​(java.lang.Object obj1,
                    java.lang.Object obj2)
        Construct a new pair using the specified values.
        Parameters:
        obj1 - the first value to store
        obj2 - the second value to store
    • Method Detail

      • swap

        public Pair swap()
        Returns a new Pair object with the values swapped.
        Returns:
        a new Pair object with the values swapped.