Class Set<A>
java.lang.Object
fj.data.Set<A>
- All Implemented Interfaces:
Iterable<A>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> Set<A> Return the elements of the given iterator as a set.private static <A> Set<A> final <B> Set<B> Binds the given function across this set.(package private) abstract Set.Colorcolor()delete()First-class deletion function.Deletes the given element from this set.static <A> Set<A> The empty set.final booleanFilters elements from this set by returning only elements which producetruewhen the given function is applied to them.final <B> BFolds this Set using the given monoid.final <B> BfoldMapRight(F<A, B> f, Monoid<B> m) Folds this Set from the right using the given monoid.final inthashCode()(package private) abstract Ahead()insert()First-class insertion function.Inserts the given element into this set.A first class function forintersect(Set).Remove all elements from this set that do not occur in the given set.final booleanisEmpty()private booleanisTR()static <A> Set<A> iterableSet(Ord<A> o, Iterable<A> as) Return the elements of the given iterable as a set.iterator()Returns an iterator over this set.static <A> Set<A> iteratorSet(Ord<A> o, Iterator<A> as) Return the elements of the given iterator as a set.static <A> Set<A> Join a set of sets into a single set.l()Find element equal to the given one.Find smallest element greater or equal to the given one.Find smallest element greater than the given one.Find largest element smaller or equal to the given one.Find largest element smaller than the given one.final <B> Set<B> Maps the given function across this set.max()member()First-class membership check.final booleanChecks if the given element is a member of this set.min()minus()A first class function forminus(Set).Remove all elements from this set that occur in the given set.ord()Returns the order of this Set.r()static <A> Set<A> Constructs a set from the given elements.static <A> Set<A> Returns a set with a single element.final intsize()Returns the size of this set.Splits this set at the given element.final booleanReturns true if this set is a subset of the given set.Returns a java.util.HashSet representation of this set.Returns a java.util.List representation of this set.Returns a java.util.Set representation of this set.Returns a java.util.TreeSet representation of this set.toList()Returns a list representation of this set.Returns a list representation of this set in reverse order.toStream()Returns a stream representation of this set.Returns a stream representation of this set in reverse order.final StringtoString()private static <A> Set.Tree<A> union()A first class function forunion(Set).Add all the elements of the given set to this set.Updates, with the given function, the first element in the set that is equal to the given element, according to the order.Methods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
ord
-
-
Constructor Details
-
Set
-
-
Method Details
-
isEmpty
public final boolean isEmpty() -
color
-
l
-
head
-
r
-
ord
-
update
Updates, with the given function, the first element in the set that is equal to the given element, according to the order.- Parameters:
a- An element to replace.f- A function to transforms the found element.- Returns:
- A pair of: (1) True if an element was found that matches the given element, otherwise false. (2) A new set with the given function applied to the first set element that was equal to the given element.
-
tryUpdate
-
empty
-
equals
-
hashCode
-
toString
-
member
Checks if the given element is a member of this set.- Parameters:
x- An element to check for membership in this set.- Returns:
- true if the given element is a member of this set.
-
member
-
insert
-
insert
-
ins
-
makeBlack
-
tr
-
balance
-
isTR
private boolean isTR() -
iterator
-
single
-
map
-
foldMap
-
foldMapRight
-
toList
-
toJavaSet
-
toJavaHashSet
-
toJavaTreeSet
-
toJavaList
-
toListReverse
-
toStream
-
toStreamReverse
-
bind
-
union
-
union
-
filter
-
delete
-
delete
-
intersect
-
intersect
-
minus
-
minus
-
min
-
max
-
size
public final int size()Returns the size of this set.- Returns:
- The number of elements in this set.
-
split
Splits this set at the given element. Returns a product-3 of:- A set containing all the elements of this set which are less than the given value.
- An option of a value equal to the given value, if one was found in this set, otherwise None.
- A set containing all the elements of this set which are greater than the given value.
- Parameters:
a- A value at which to split this set.- Returns:
- Two sets and an optional value, where all elements in the first set are less than the given value and all the elements in the second set are greater than the given value, and the optional value is the given value if found, otherwise None.
-
lookup
-
lookupLT
-
lookupGT
-
lookupLE
-
lookupGE
-
subsetOf
-
join
-
iterableSet
-
iteratorSet
-
arraySet
Return the elements of the given iterator as a set.- Parameters:
o- An order for the elements of the new set.as- An iterator of elements to add to a set.- Returns:
- A new set containing the elements of the given iterator.
-
set
Constructs a set from the given elements.- Parameters:
o- An order for the elements of the new set.as- The elements to add to a set.- Returns:
- A new set containing the elements of the given iterable.
-