Class SetAlgebra.SetAlgebraImpl<E>

java.lang.Object
cloud.opencode.base.collections.SetAlgebra.SetAlgebraImpl<E>
Type Parameters:
E - element type | 元素类型
All Implemented Interfaces:
SetAlgebra<E>
Enclosing interface:
SetAlgebra<E>

public static class SetAlgebra.SetAlgebraImpl<E> extends Object implements SetAlgebra<E>
Default implementation of SetAlgebra. SetAlgebra 的默认实现。
Since:
JDK 25, opencode-base-collections V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • getSet

      public Set<E> getSet()
      Description copied from interface: SetAlgebra
      Get the underlying set. 获取底层集合。
      Specified by:
      getSet in interface SetAlgebra<E>
      Returns:
      the set | 集合
    • union

      public Set<E> union(Set<? extends E> other)
      Description copied from interface: SetAlgebra
      Compute union with another set. 计算与另一个集合的并集。
      Specified by:
      union in interface SetAlgebra<E>
      Parameters:
      other - the other set | 另一个集合
      Returns:
      union of the two sets | 两个集合的并集
    • intersection

      public Set<E> intersection(Set<?> other)
      Description copied from interface: SetAlgebra
      Compute intersection with another set. 计算与另一个集合的交集。
      Specified by:
      intersection in interface SetAlgebra<E>
      Parameters:
      other - the other set | 另一个集合
      Returns:
      intersection of the two sets | 两个集合的交集
    • difference

      public Set<E> difference(Set<?> other)
      Description copied from interface: SetAlgebra
      Compute difference with another set (this - other). 计算与另一个集合的差集(this - other)。
      Specified by:
      difference in interface SetAlgebra<E>
      Parameters:
      other - the other set | 另一个集合
      Returns:
      difference of the two sets | 两个集合的差集
    • symmetricDifference

      public Set<E> symmetricDifference(Set<? extends E> other)
      Description copied from interface: SetAlgebra
      Compute symmetric difference with another set. 计算与另一个集合的对称差集。
      Specified by:
      symmetricDifference in interface SetAlgebra<E>
      Parameters:
      other - the other set | 另一个集合
      Returns:
      symmetric difference of the two sets | 两个集合的对称差集
    • isSubsetOf

      public boolean isSubsetOf(Set<?> other)
      Description copied from interface: SetAlgebra
      Check if this set is a subset of another set. 检查此集合是否为另一个集合的子集。
      Specified by:
      isSubsetOf in interface SetAlgebra<E>
      Parameters:
      other - the other set | 另一个集合
      Returns:
      true if this is a subset | 如果是子集则返回 true
    • isSupersetOf

      public boolean isSupersetOf(Set<?> other)
      Description copied from interface: SetAlgebra
      Check if this set is a superset of another set. 检查此集合是否为另一个集合的超集。
      Specified by:
      isSupersetOf in interface SetAlgebra<E>
      Parameters:
      other - the other set | 另一个集合
      Returns:
      true if this is a superset | 如果是超集则返回 true
    • isProperSubsetOf

      public boolean isProperSubsetOf(Set<?> other)
      Description copied from interface: SetAlgebra
      Check if this set is a proper subset of another set. 检查此集合是否为另一个集合的真子集。
      Specified by:
      isProperSubsetOf in interface SetAlgebra<E>
      Parameters:
      other - the other set | 另一个集合
      Returns:
      true if this is a proper subset | 如果是真子集则返回 true
    • isProperSupersetOf

      public boolean isProperSupersetOf(Set<?> other)
      Description copied from interface: SetAlgebra
      Check if this set is a proper superset of another set. 检查此集合是否为另一个集合的真超集。
      Specified by:
      isProperSupersetOf in interface SetAlgebra<E>
      Parameters:
      other - the other set | 另一个集合
      Returns:
      true if this is a proper superset | 如果是真超集则返回 true
    • isDisjoint

      public boolean isDisjoint(Set<?> other)
      Description copied from interface: SetAlgebra
      Check if this set is disjoint with another set. 检查此集合是否与另一个集合不相交。
      Specified by:
      isDisjoint in interface SetAlgebra<E>
      Parameters:
      other - the other set | 另一个集合
      Returns:
      true if disjoint | 如果不相交则返回 true
    • filter

      public Set<E> filter(Predicate<? super E> predicate)
      Description copied from interface: SetAlgebra
      Filter elements matching a predicate. 过滤匹配谓词的元素。
      Specified by:
      filter in interface SetAlgebra<E>
      Parameters:
      predicate - the predicate | 谓词
      Returns:
      filtered set | 过滤后的集合