Package org.organicdesign.fp.collections
Interface BaseSet<E>
-
- All Superinterfaces:
Collection<E>
,Iterable<E>
,Set<E>
,Sized
,Transformable<E>
,UnmodCollection<E>
,UnmodIterable<E>
,UnmodSet<E>
- All Known Subinterfaces:
ImSet<E>
,ImSortedSet<E>
,MutSet<E>
- All Known Implementing Classes:
PersistentHashSet
,PersistentHashSet.MutHashSet
,PersistentTreeSet
public interface BaseSet<E> extends UnmodSet<E>
Adds copy-on-write, "fluent interface" methods toUnmodSet
. Lowest common ancestor ofMutSet
,ImSet
, andImSortedSet
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.organicdesign.fp.collections.UnmodIterable
UnmodIterable.UnIterable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull BaseSet<E>
put(E e)
Adds an element.@NotNull BaseSet<E>
union(Iterable<? extends E> iter)
Returns a new set containing all the items.@NotNull BaseSet<E>
without(E key)
Removes this key from the set-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.Set
equals, hashCode, size, spliterator
-
Methods inherited from interface org.organicdesign.fp.xform.Transformable
any, toImList, toImMap, toImRrbt, toImSet, toImSortedMap, toImSortedSet, toMutList, toMutMap, toMutRrbt, toMutSet, toMutSortedMap, toMutSortedSet
-
-
-
-
Method Detail
-
put
@NotNull @NotNull BaseSet<E> put(E e)
Adds an element. If the element already exists in this set, the new value overwrites the old one. If the new element is the same as an old element (based on the address of that item in memory, not an equals test), the old set may be returned unchanged.- Parameters:
e
- the element to add to this set- Returns:
- a new set with the element added (see note above about adding duplicate elements).
-
union
@NotNull @NotNull BaseSet<E> union(Iterable<? extends E> iter)
Returns a new set containing all the items.
-
-