Interface PSet<E>

  • Type Parameters:
    E - the type of elements maintained by this set

    public interface PSet<E>
    Persistent (functional) Set.
    Author:
    Evgeny Mandrikov
    • Method Detail

      • add

        PSet<E> add​(E e)
        Returns:
        new set with added element, or this if element already in the set
      • remove

        PSet<E> remove​(E e)
        Returns:
        new set with removed element, or this if set does not contain given element
      • contains

        boolean contains​(E e)
        Returns:
        true if this set contains the specified element
      • forEach

        void forEach​(Consumer<E> action)
        Performs the given action for each entry in this set until all elements have been processed or the action throws an exception.
      • isEmpty

        boolean isEmpty()
        Returns:
        true if this set contains no elements
      • toString

        String toString()
        The string representation consists of a list of elements in the ascending order of hash codes. If two elements have same hash code, then their relative order is arbitrary, but stable.
        Overrides:
        toString in class Object
        Returns:
        a string representation of this set