Interface FiniteSet<E>

All Superinterfaces:
Iterable<E>, Set<E>
All Known Implementing Classes:
Boolean, BooleanAlgebra, Booleans, DiscreteSet

public interface FiniteSet<E> extends Set<E>, Iterable<E>
Represents a set with a finite number of elements.

Finite sets allow iteration over their elements and have a definite size.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns an iterator over the elements in this set.
    long
    Returns the number of elements in this set (its cardinality).
    default Stream<E>
    Returns a sequential Stream with this set as its source.

    Methods inherited from interface Iterable

    forEach, spliterator

    Methods inherited from interface Set

    contains, description, isEmpty
  • Method Details

    • size

      long size()
      Returns the number of elements in this set (its cardinality).
      Returns:
      the cardinality of this set
    • stream

      default Stream<E> stream()
      Returns a sequential Stream with this set as its source.
      Returns:
      a stream over the elements in this set
    • iterator

      Iterator<E> iterator()
      Returns an iterator over the elements in this set.
      Specified by:
      iterator in interface Iterable<E>
      Returns:
      an iterator over the elements in this set