Class GroupKey

java.lang.Object
de.renebergelt.quiterables.grouping.GroupKey

public class GroupKey extends Object
Represents a group key (All group key instances with the same elements (value-wise) are considered equal and have the same hashCode
Author:
René Bergelt
  • Constructor Summary

    Constructors
    Constructor
    Description
    GroupKey​(Object... parts)
    Create a new group key
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares this group key to the given one for data (!)
    boolean
    equals​(Object other)
     
    Returns the first key part of this GroupKey (use get(...) to receive the other parts) Internally calls get(0)
    get​(int index)
    Returns the key part with the given index
    int
     
    int
    Return the number of key parts this group key consists of

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GroupKey

      public GroupKey(Object... parts)
      Create a new group key
      Parameters:
      parts - The parts which compose this group key (order is critical!)
  • Method Details

    • equals

      public boolean equals(GroupKey gk)
      Compares this group key to the given one for data (!) equality (not only reference equality)
      Parameters:
      gk - The group key to compare to
      Returns:
      True if the keys are considered equal
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • partCount

      public int partCount()
      Return the number of key parts this group key consists of
      Returns:
      The number of key parts this group key consists of
    • get

      public Object get(int index)
      Returns the key part with the given index
      Parameters:
      index - Index of the key part
      Returns:
      The value of the key part at the given index
    • first

      public Object first()
      Returns the first key part of this GroupKey (use get(...) to receive the other parts) Internally calls get(0)
      Returns:
      The first key part