Class Difference<T>

java.lang.Object
me.lucko.luckperms.common.util.Difference<T>
Type Parameters:
T - the value type

public class Difference<T> extends Object
Records a log of the changes that occur as a result of mutations (add or remove operations).
  • Constructor Details

    • Difference

      public Difference()
  • Method Details

    • getChanges

      public Set<Difference.Change<T>> getChanges()
      Gets the recorded changes.
      Returns:
      the changes
    • isEmpty

      public boolean isEmpty()
      Gets if no changes have been recorded.
      Returns:
      if no changes have been recorded
    • getChanges

      public Set<T> getChanges(Difference.ChangeType type)
      Gets the recorded changes of a given type
      Parameters:
      type - the type of change
      Returns:
      the changes
    • getAdded

      public Set<T> getAdded()
      Gets the values that have been added.
      Returns:
      the added values
    • getRemoved

      public Set<T> getRemoved()
      Gets the values that have been removed.
      Returns:
      the removed values
    • clear

      public void clear()
      Clears all recorded changes.
    • recordChange

      public void recordChange(Difference.ChangeType type, T value)
      Records a change.
      Parameters:
      type - the type of change
      value - the changed value
    • recordChanges

      public void recordChanges(Difference.ChangeType type, Iterable<T> values)
      Records some changes.
      Parameters:
      type - the type of change
      values - the changed values
    • mergeFrom

      public Difference<T> mergeFrom(Difference<T> other)
      Merges the recorded differences in other into this.
      Parameters:
      other - the other differences
      Returns:
      this
    • toString

      public String toString()
      Overrides:
      toString in class Object