java.lang.Object
io.github.palexdev.virtualizedfx.collections.SetsDiff<T>
Type Parameters:
T - the type of objects contained in the Sets

public class SetsDiff<T> extends Object
Utils class to compute the difference between to Sets.

The resulting SetsDiff instance will contain two Sets for added and removed items.
  • Method Details

    • difference

      public static <T> SetsDiff<T> difference(Set<T> first, Set<T> second)
      Computes the difference between the given sets.

      The resulting "added" Set will contain all the items of the second Set that are NOT contained in the first.

      The resulting "removed" Set will contain all the items of the first Set that are NOT contained in the second.

      Returns:
      an instance of SetsDiff
    • indexDifference

      public static SetsDiff<Integer> indexDifference(Set<Integer> first, Set<Integer> second)
      Computes the difference between the given sets of indexes.

      The resulting "added" Set will contain all the items of the second Set that are NOT contained in the first.

      The resulting "removed" Set will contain all the items of the first Set that are NOT contained in the second and that are greater or equal to 0.

      Returns:
      an instance of SetsDiff
    • getAdded

      public Set<T> getAdded()
      Returns:
      the Set containing all the added items
    • getRemoved

      public Set<T> getRemoved()
      Returns:
      the Set containing all the removed items