AbstractUnordered
Abstract base class providing common implementations for unordered collections. Concrete subclasses (Unordered_Bag and Unordered_Set) differ in their underlying storage and duplicate-handling behaviour.
Type parameters
- T
-
the type of elements contained in the collection (covariant).
Value parameters
- elements
-
the underlying storage, accessed via
IterableOnce.
Attributes
- Graph
-
- Supertypes
- Known subtypes
-
class Unordered_Bag[T]class Unordered_Set[T]
Members list
Value members
Abstract methods
Creates a new instance of Unordered containing the specified sequence of elements.
Creates a new instance of Unordered containing the specified sequence of elements.
This method allows the initialization of an unordered collection with a given sequence of elements. The order of elements in the input sequence is not preserved or relevant in the resulting unordered collection.
Type parameters
- U
-
a supertype of
T, representing the type of elements in the input sequence
Value parameters
- elements
-
a sequence of elements of type
Uto be added to the unordered collection
Attributes
- Returns
-
a new instance of
Unordered[U]containing the specified elements
Concrete methods
Adds the specified element to the unordered collection.
Adds the specified element to the unordered collection.
Type parameters
- U
-
a supertype of T
Value parameters
- u
-
the element to be added to the collection
Attributes
- Returns
-
a new instance of
Unorderedwith the specified element added
Filters the elements of the collection using the provided predicate function.
Filters the elements of the collection using the provided predicate function.
This method returns a new collection that contains only those elements for which the predicate function p evaluates to true.
Value parameters
- p
-
a predicate function that takes an element of type
Tand returns a boolean, indicating whether the element satisfies the condition or not.
Attributes
- Returns
-
an instance of
Unordered[T]containing the elements that satisfy the predicate.
Finds the first element in the collection that satisfies the given predicate function.
Finds the first element in the collection that satisfies the given predicate function.
This method traverses the unordered collection to identify the first element for which the provided predicate function p evaluates to true. If such an element is found, it is returned wrapped in an Option. If no such element exists, None is returned.
Value parameters
- p
-
a predicate function that takes an element of type
Tand returns a boolean, indicating whether the element satisfies the condition.
Attributes
- Returns
-
an
Optioncontaining the first element that satisfies the predicate, orNoneif no such element exists in the collection.
Checks if the unordered collection of elements is empty.
Checks if the unordered collection of elements is empty.
Attributes
- Returns
-
trueif the collection contains no elements,falseotherwise.
Returns an iterator over the elements in the adjacency set. NOTE that the order of the elements in the iterator is unpredictable.
Returns an iterator over the elements in the adjacency set. NOTE that the order of the elements in the iterator is unpredictable.
Attributes
- Returns
-
an
Iterator[T]over the elements of typeTcontained in the set.
Retrieves the number of elements contained in this collection.
Retrieves the number of elements contained in this collection.
Attributes
- Returns
-
the total count of elements as an integer.
Inherited methods
Counts the elements in the collection that satisfy the given predicate.
Counts the elements in the collection that satisfy the given predicate.
This method evaluates each element in the unordered collection using the provided predicate function p. It returns the total number of elements for which the predicate evaluates to true.
Value parameters
- p
-
a predicate function that takes an element of type
Tand returns a boolean, indicating whether the element satisfies the condition
Attributes
- Returns
-
the number of elements in the collection that satisfy the predicate
- Inherited from:
- Unordered
Inherited and Abstract methods
Checks if the specified element is contained within the collection.
Checks if the specified element is contained within the collection.
Value parameters
- u
-
the element to check for existence in the collection
Attributes
- Returns
-
true if the element exists in the collection, otherwise false
- Inherited from:
- Unordered