Class MinusSetView<E>

Type Parameters:
E - the type of elements in this set
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>

public final class MinusSetView<E> extends AbstractUnmodifiableCollection<E> implements Set<E>
A view that represents the result of subtracting one set from another. Specifically, this class models the set difference: superset - subset.

The class assumes that all elements of the subset are contained in the superset. This property must be ensured by the caller; the class does not perform any validation checks for this condition.

This is an unmodifiable view, and all mutating operations will throw an UnsupportedOperationException.

Author:
Mathias Hofer
  • Constructor Details

    • MinusSetView

      public MinusSetView(Set<E> superset, Set<E> subset)
      Constructs a view of the result of superset - subset.

      As the name suggests, it is expected that all elements of subset are contained in superset, otherwise one has to expect unreasonable results.

      It is up to the caller to ensure this property, this class performs no additional checks.

      Parameters:
      superset - the minuend
      subset - the subtrahend
  • Method Details