Class Tuple<K,​V>

java.lang.Object
org.fastily.jwiki.util.Tuple<K,​V>
Type Parameters:
K - The type of Object allowed for the first Object in the tuple.
V - The type of Object allowed for the second Object in the tuple.

public class Tuple<K,​V>
extends Object
Simple implementation of a Tuple. A Tuple is an immutable paired 2-set of values (e.g. (x, y)), and may consist of any two Objects (may be in the same class or a different class).
Author:
Fastily
  • Field Summary

    Fields 
    Modifier and Type Field Description
    K x
    The x value of the tuple
    V y
    The y value of the tuple
  • Constructor Summary

    Constructors 
    Constructor Description
    Tuple​(K x, V y)
    Creates a Tuple from the parameter values.
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(Object o)
    Determines if two tuples are equal.
    int hashCode()
    Gets a hashcode for this object.
    String toString()
    Gets a String representation of this object.

    Methods inherited from class java.lang.Object

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

    • x

      public final K x
      The x value of the tuple
    • y

      public final V y
      The y value of the tuple
  • Constructor Details

    • Tuple

      public Tuple​(K x, V y)
      Creates a Tuple from the parameter values.
      Parameters:
      x - The x value of the tuple
      y - The y value of the tuple
  • Method Details

    • toString

      public String toString()
      Gets a String representation of this object. Nice for debugging.
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Gets a hashcode for this object. Good for mapping constructs.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals​(Object o)
      Determines if two tuples are equal. Equal tuples have the same two elements in the same order.
      Overrides:
      equals in class Object