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

net.corda.core.utilities

## Class NonEmptySet.Companion

- net.corda.core.utilities.NonEmptySet.Companion

- Enclosing class:
    NonEmptySet<T>

      public static class NonEmptySet.Companion

- - ### Method Detail

    - #### of

          @JvmStatic
           @NotNull
          public <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 <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 <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`