Class Tuple

java.lang.Object
edu.uky.ai.util.Tuple

public class Tuple extends Object
A tuple is simply an array of Objects implemented such that two tuples are the same (i.e. Object#equals(Object)) if their arrays contain values which are equal. Tuples can, for example, be use as multi-valued keys to HashMaps.
Author:
Stephen G. Ware
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final Object[]
    The array of objects in the tuple
  • Constructor Summary

    Constructors
    Constructor
    Description
    Tuple(int size)
    Constructs a tuple of a given size with each element as null.
    Tuple(Object... elements)
    Constructs a tuple from a given set of objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
     
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • elements

      public final Object[] elements
      The array of objects in the tuple
  • Constructor Details

    • Tuple

      public Tuple(Object... elements)
      Constructs a tuple from a given set of objects.
      Parameters:
      elements - the objects
    • Tuple

      public Tuple(int size)
      Constructs a tuple of a given size with each element as null.
      Parameters:
      size - the size of the tuple
  • Method Details