Package com.activeviam.collections
Interface ImmutableSet<E>
- Type Parameters:
E- The type of items contained in this set.
- All Superinterfaces:
ImmutableCollection<E>,Iterable<E>
- All Known Implementing Classes:
ImmutableHashSet
Immutable set with a functional API.
- Author:
- ActiveViam
-
Method Summary
Modifier and TypeMethodDescriptionCreate a new collection having the items of this collection plus one new item.Create a new collection having the items of this collection plus new items.default ImmutableSet<E>addAll(ImmutableCollection<E> col) Create a new collection having the items of this collection plus items from another collection.default ImmutableSet<E>addAll(ImmutableSet<E> set) Create a new set having the items of this collection plus items from another set.addAll(Collection<? extends E> col) Create a new collection having the items of this collection plus items from another collection.default ImmutableSet<E>Prints the content of this collection to System.out and return itself.Filter the items from this set with a predicate.<R> ImmutableSet<R>Flat map this set.default StringConcatenate thetoString()of all the items in this set separated by a separator.<R> ImmutableSet<R>Map this set.toList()Create a read-only java util list from this set.<V> ImmutableMap<E,V> Map the items of this set.toSet()Create a read-only java util set from this set.Methods inherited from interface com.activeviam.collections.ImmutableCollection
addAll, contains, doesNotContain, every, find, findIndex, first, forEach, forEachUntil, getFirst, isEmpty, isNotEmpty, reduce, size, some, toArray, toArray, toCollectionMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
add
Description copied from interface:ImmutableCollectionCreate a new collection having the items of this collection plus one new item.- Specified by:
addin interfaceImmutableCollection<E>- Parameters:
e- The items to add.- Returns:
- The new collection.
-
add
Description copied from interface:ImmutableCollectionCreate a new collection having the items of this collection plus new items.- Specified by:
addin interfaceImmutableCollection<E>- Parameters:
first- The first item to add.second- The second item to add.rest- The other items to add.- Returns:
- The new collection.
-
map
Map this set.- Type Parameters:
R- The type returned by the mapper.- Parameters:
mapper- The mapping function.- Returns:
- The set containing the mapped elements.
- See Also:
-
flatMap
Flat map this set.- Specified by:
flatMapin interfaceImmutableCollection<E>- Type Parameters:
R- The type returned by the mapper.- Parameters:
mapper- The mapping function.- Returns:
- The set containing the mapped elements.
- See Also:
-
toList
ImmutableList<E> toList()Create a read-only java util list from this set.- Returns:
- The list.
-
toSet
Create a read-only java util set from this set.- Returns:
- The set.
-
filter
Filter the items from this set with a predicate.- Parameters:
predicate- The predicate filtering the items.- Returns:
- The set containing only the items that matched the predicate.
-
toMap
Map the items of this set.- Type Parameters:
V- The type returned by the mapper.- Parameters:
mapper- The mapping function that will be applied to each item of this set.- Returns:
- The set containing the mapped items.
-
addAll
Description copied from interface:ImmutableCollectionCreate a new collection having the items of this collection plus items from another collection.- Specified by:
addAllin interfaceImmutableCollection<E>- Parameters:
col- The items to add.- Returns:
- The new collection.
-
addAll
Create a new set having the items of this collection plus items from another set.- Parameters:
set- The items to add.- Returns:
- The new set.
-
addAll
Description copied from interface:ImmutableCollectionCreate a new collection having the items of this collection plus items from another collection.- Specified by:
addAllin interfaceImmutableCollection<E>- Parameters:
col- The items to add.- Returns:
- The new collection.
-
debug
Prints the content of this collection to System.out and return itself. Useful for debugging inside chained calls.- Parameters:
prefix- The prefix to print before the collection.- Returns:
- The collection itself.
-
join
Concatenate thetoString()of all the items in this set separated by a separator.- Parameters:
separator- The string to place between each item's string representation. Cannot be null.- Returns:
- The string formed by the concatenation of all the members with the separator.
-