Interface Set<T>

Type Parameters:
T - type of Set entries
All Superinterfaces:
Iterable<T>, SetKernel<T>, Standard<Set<T>>
All Known Implementing Classes:
Set1L, Set2, Set3, Set4, SetSecondary

public interface Set<T> extends SetKernel<T>
SetKernel enhanced with secondary methods.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Set<T> s)
    Adds to this all elements of s that are not already in this, also removing just those elements from s.
    boolean
    Reports whether this is a subset of s.
    remove(Set<T> s)
    Removes from this all elements of s that are also in this, leaving s unchanged, and returns the elements actually removed.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator

    Methods inherited from interface components.set.SetKernel

    add, contains, remove, removeAny, size

    Methods inherited from interface components.standard.Standard

    clear, newInstance, transferFrom
  • Method Details

    • add

      void add(Set<T> s)
      Adds to this all elements of s that are not already in this, also removing just those elements from s.
      Parameters:
      s - the Set whose elements are to be added to this
      Updates:
      this, s
      Ensures:
      this = #this union #s  and
      s = #this intersection #s
    • remove

      Set<T> remove(Set<T> s)
      Removes from this all elements of s that are also in this, leaving s unchanged, and returns the elements actually removed.
      Parameters:
      s - the Set whose elements are to be removed from this
      Returns:
      the Set whose elements actually were removed from this
      Updates:
      this
      Ensures:
      this = #this \ s  and
      remove = #this intersection s
    • isSubset

      boolean isSubset(Set<T> s)
      Reports whether this is a subset of s.
      Parameters:
      s - the second set
      Returns:
      whether this is a subset of s
      Ensures:
      isSubset = this is subset of s