Fuzion Logo
flang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

psSet

🌌psSet

psSet -- a partially sorted set based on psMap

psSet is a persistent set of ordered values. This set is generally
well-behaved with respect to cumulative and average performance.

WARNING: Due to the high worst-case time for addition, this structure should
not be used in situations when adding a single element repeatedly to the same
instance of psSet is performance critical. If the resulting set's size n is a
power of 2, this will trigger the worst-case addition time resutling in
O(m*n log² n) for adding an element m times.

add new element k to this set.

redefines Set.add:
add new element k to this set.

add all elements of the given Sequence to this set

create a sorted array from the elements of this set

redefines Sequence.asArray:
collect the contents of this Sequence into an array

list representation of values in this set

redefines Set.asList:
list representation of values in this set

redefines Sequence.asList:
create a list from this Sequence.

A list is immutable, so it can be reused and shared between threads.
Compared to a stream, a list may require more (heap) allocation.

Default implementation uses asStream. Heirs must redefine at least
one of asList or asStream.

does this set contain the given value?

redefines Set.contains:
does this set contain the given value?

an empty psSet

check if an element equal to given element k is part of this set

intersection of two psSets

union of two psSets

get the highest element in this set

get the lowest element in this set

print contents of this set

number of elements in this set

number of entries in this set. May be undefined, i.e., a range of
floating point numbers or an infinite set.

redefines Set.sizeOption:
number of entries in this set. May be undefined, i.e., a range of
floating point numbers or an infinite set.

monoid of psSet with infix ⋃ operation.