Class SetUtils.SetView<E>

  • Type Parameters:
    E - the element type
    All Implemented Interfaces:
    Iterable<E>, Collection<E>, Set<E>
    Enclosing class:

    public abstract static class SetUtils.SetView<E>
    extends AbstractSet<E>
    An unmodifiable view of a set that may be backed by other sets.

    If the decorated sets change, this view will change as well. The contents of this view can be transferred to another instance via the copyInto(Set) and toSet() methods.

    • Constructor Detail

      • SetView

        public SetView()
    • Method Detail

      • copyInto

        public <S extends Set<E>> void copyInto​(S set)
        Copies the contents of this view into the provided set.
        Type Parameters:
        S - the set type
        set - the set for copying the contents
      • toSet

        public Set<E> toSet()
        Returns a new set containing the contents of this view.
        a new set containing all elements of this view