NonEmptySet
Keywords: net.corda.core.utilities.NonEmptySet class
Date: 2023-09-18

net.corda.core.utilities

## Class NonEmptySet<T>

- net.corda.core.utilities.NonEmptySet<T>

-     public class NonEmptySet<T>

  An immutable ordered non-empty set.

- - ### Field Detail

    - #### Companion

          public static net.corda.core.utilities.NonEmptySet.Companion Companion

  - ### Method Detail

    - #### head

          public T head()

      Returns the first element of the set.

    - #### isEmpty

          public boolean isEmpty()

    - #### iterator

          @NotNull
          public java.util.Iterator<T> iterator()

    - #### forEach

          public void forEach(@NotNull
                              java.util.function.Consumer<? super T> action)

    - #### stream

          @NotNull
          public java.util.stream.Stream<T> stream()

    - #### parallelStream

          @NotNull
          public java.util.stream.Stream<T> parallelStream()

    - #### spliterator

          @NotNull
          public java.util.Spliterator<T> spliterator()

    - #### equals

          public boolean equals(@Nullable
                                java.lang.Object other)

    - #### hashCode

          public int hashCode()

    - #### toString

          @NotNull
          public java.lang.String toString()

    - #### getSize

          public int getSize()

    - #### contains

          public boolean contains(java.lang.Object element)

    - #### containsAll

          public boolean containsAll(@NotNull
                                     java.util.Collection<? extends java.lang.Object> elements)

    - #### of

          @JvmStatic
           @NotNull
          public static <T> NonEmptySet<T> of(T element)

      Returns a singleton set containing `element`. This behaves the same as Collections.singleton but returns a `class NonEmptySet` for the extra type-safety.

      See Also:
        `element`, Collections.singleton, `class NonEmptySet`

    - #### of

          @JvmStatic
           @NotNull
          public static <T> NonEmptySet<T> of(T first,
                                                                   T second,
                                                                   @NotNull
                                                                   T... rest)

      Returns a non-empty set containing the given elements, minus duplicates, in the order each was specified.

    - #### copyOf

          @JvmStatic
           @NotNull
          public static <T> NonEmptySet<T> copyOf(@NotNull
                                                                       java.util.Collection<? extends T> elements)

      Returns a non-empty set containing each of `elements`, minus duplicates, in the order each appears first in the source collection.

      Throws:
        `IllegalArgumentException` - If `elements` is empty.
      See Also:
        `elements`