Package software.kes.collectionviews
Interface ImmutableNonEmptySet<A>
-
- Type Parameters:
A- the element type
- All Superinterfaces:
software.kes.enhancediterables.EnhancedIterable<A>,software.kes.enhancediterables.FiniteIterable<A>,com.jnape.palatable.lambda.functor.Functor<A,software.kes.enhancediterables.EnhancedIterable<?>>,Immutable,software.kes.enhancediterables.ImmutableFiniteIterable<A>,software.kes.enhancediterables.ImmutableIterable<A>,software.kes.enhancediterables.ImmutableNonEmptyFiniteIterable<A>,software.kes.enhancediterables.ImmutableNonEmptyIterable<A>,ImmutableSet<A>,java.lang.Iterable<A>,software.kes.enhancediterables.NonEmptyFiniteIterable<A>,software.kes.enhancediterables.NonEmptyIterable<A>,NonEmptySet<A>,Set<A>
public interface ImmutableNonEmptySet<A> extends NonEmptySet<A>, ImmutableSet<A>, software.kes.enhancediterables.ImmutableNonEmptyFiniteIterable<A>
ASetthat is guaranteed at compile-time to be non-empty and safe from mutation anywhere. In other words, it owns the sole reference to the underlying collection.Provides all the guarantees of
Set,NonEmptySet, andImmutableSet.
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default ImmutableNonEmptySet<A>distinct()Since aImmutableNonEmptySetalready contains only distinct values, this method always returns itself.static <A> ImmutableNonEmptySet<A>of(A first, A... more)Creates aImmutableNonEmptySetwith the given elements.default ImmutableNonEmptySet<A>toImmutable()Returns anImmutableNonEmptySetcontaining the same elements as this one.default com.jnape.palatable.lambda.adt.Maybe<? extends ImmutableNonEmptySet<A>>toNonEmpty()Attempts to convert thisImmutableSetto anImmutableNonEmptySet.default ImmutableNonEmptySet<A>toNonEmptyOrThrow()Attempts to convert thisImmutableSetto aImmutableNonEmptySet.-
Methods inherited from interface software.kes.enhancediterables.EnhancedIterable
concat, toArray, toCollection, zipWith, zipWith
-
Methods inherited from interface software.kes.enhancediterables.FiniteIterable
append, concat, cross, cross, drop, dropWhile, filter, foldLeft, foldRight, partition, prepend, slide, span, tails, takeWhile, zipWith
-
Methods inherited from interface software.kes.enhancediterables.ImmutableFiniteIterable
append, concat, cross, drop, dropWhile, filter, inits, partition, slide, span, tails, takeWhile, zipWith
-
Methods inherited from interface software.kes.enhancediterables.ImmutableIterable
concat, take, zipWith
-
Methods inherited from interface software.kes.enhancediterables.ImmutableNonEmptyFiniteIterable
concat, cross, cycle, fmap, init, intersperse, magnetizeBy, prepend, prependAll, reverse, tail, toFinite, zipWith
-
Methods inherited from interface software.kes.enhancediterables.ImmutableNonEmptyIterable
concat, zipWith
-
Methods inherited from interface software.kes.enhancediterables.NonEmptyFiniteIterable
concat, concat, cross, cycle, fmap, intersperse, last, magnetizeBy, prependAll, reduceLeft, reduceRight, reverse, tail, toFinite, zipWith
-
Methods inherited from interface software.kes.enhancediterables.NonEmptyIterable
concat, head, iterator, zipWith
-
Methods inherited from interface software.kes.collectionviews.NonEmptySet
isEmpty
-
-
-
-
Method Detail
-
distinct
default ImmutableNonEmptySet<A> distinct()
Since aImmutableNonEmptySetalready contains only distinct values, this method always returns itself.- Specified by:
distinctin interfacesoftware.kes.enhancediterables.FiniteIterable<A>- Specified by:
distinctin interfacesoftware.kes.enhancediterables.ImmutableFiniteIterable<A>- Specified by:
distinctin interfacesoftware.kes.enhancediterables.ImmutableNonEmptyFiniteIterable<A>- Specified by:
distinctin interfaceImmutableSet<A>- Specified by:
distinctin interfacesoftware.kes.enhancediterables.NonEmptyFiniteIterable<A>- Specified by:
distinctin interfaceNonEmptySet<A>- Specified by:
distinctin interfaceSet<A>- Returns:
- itself
-
toImmutable
default ImmutableNonEmptySet<A> toImmutable()
Returns anImmutableNonEmptySetcontaining the same elements as this one.Since this is an
ImmutableNonEmptySetalready, this method simply returns itself.- Specified by:
toImmutablein interfaceImmutableSet<A>- Specified by:
toImmutablein interfaceNonEmptySet<A>- Specified by:
toImmutablein interfaceSet<A>- Returns:
- itself
-
toNonEmpty
default com.jnape.palatable.lambda.adt.Maybe<? extends ImmutableNonEmptySet<A>> toNonEmpty()
Attempts to convert thisImmutableSetto anImmutableNonEmptySet.Since this will always be successful for
ImmutableNonEmptySets, this method always returns itself wrapped in aMaybe.just(A).Does not make copies of any underlying data structures.
- Specified by:
toNonEmptyin interfacesoftware.kes.enhancediterables.EnhancedIterable<A>- Specified by:
toNonEmptyin interfacesoftware.kes.enhancediterables.FiniteIterable<A>- Specified by:
toNonEmptyin interfacesoftware.kes.enhancediterables.ImmutableFiniteIterable<A>- Specified by:
toNonEmptyin interfacesoftware.kes.enhancediterables.ImmutableIterable<A>- Specified by:
toNonEmptyin interfacesoftware.kes.enhancediterables.ImmutableNonEmptyFiniteIterable<A>- Specified by:
toNonEmptyin interfacesoftware.kes.enhancediterables.ImmutableNonEmptyIterable<A>- Specified by:
toNonEmptyin interfaceImmutableSet<A>- Specified by:
toNonEmptyin interfacesoftware.kes.enhancediterables.NonEmptyFiniteIterable<A>- Specified by:
toNonEmptyin interfacesoftware.kes.enhancediterables.NonEmptyIterable<A>- Specified by:
toNonEmptyin interfaceNonEmptySet<A>- Specified by:
toNonEmptyin interfaceSet<A>- Returns:
- this
ImmutableNonEmptySetwrapped in aMaybe.just(A)
-
toNonEmptyOrThrow
default ImmutableNonEmptySet<A> toNonEmptyOrThrow()
Attempts to convert thisImmutableSetto aImmutableNonEmptySet.Since this will always be successful for
ImmutableNonEmptySets, this method always returns itself.Does not make copies of any underlying data structures.
- Specified by:
toNonEmptyOrThrowin interfaceImmutableSet<A>- Specified by:
toNonEmptyOrThrowin interfaceNonEmptySet<A>- Specified by:
toNonEmptyOrThrowin interfaceSet<A>- Returns:
- this
ImmutableNonEmptySet
-
of
@SafeVarargs static <A> ImmutableNonEmptySet<A> of(A first, A... more)
Creates aImmutableNonEmptySetwith the given elements.- Type Parameters:
A- the element type- Parameters:
first- the first elementmore- the remaining elements- Returns:
- an
ImmutableNonEmptySet<A>
-
-