Class UnionFind<T>

java.lang.Object
xyz.janboerman.scalaloader.util.UnionFind<T>
Type Parameters:
T - the type of elements in the Union-Find

public class UnionFind<T> extends Object
Represents a Union-Find (or 'disjoint union') data structure. This Union-Find does not support null elements.
  • Constructor Details

    • UnionFind

      public UnionFind()
  • Method Details

    • getParent

      public T getParent(T value)
    • add

      public void add(T value)
    • setParent

      public void setParent(T child, T parent)
    • getRepresentative

      public T getRepresentative(T value)
    • unite

      public void unite(T one, T two)
    • values

      public Set<T> values()
    • representatives

      public Set<T> representatives()
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object