Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BiConsumer ¶
type BiConsumer[T, U any] func(T, U)
type BiFunction ¶
type BiFunction[T, U, R any] func(T, U) R
type Collection ¶
type Collection[E comparable] interface { Iterable[E] // Ensures that this collection contains the specified element. // // Returns true if this collection changed as a result of the call Add(e E) bool // Adds all of the elements in the specified collection to this collection. // // Returns true if this collection changed as a result of the call AddAll(Collection[E]) bool // Removes all of the elements from this collection. Clear() // Returns true if this collection contains the specified element. Contains(E) bool // Returns true if this collection contains all of the elements in the specified collection. ContainsAll(Collection[E]) bool // Returns true if this collection contains no elements. IsEmpty() bool // Returns an iterator over the elements in this collection. Iterator() Iterator[E] // Removes the specified element from this collection if it is present. // // Returns true if this collection contained the specified element Remove(E) bool // Removes all of the elements of this collection that satisfy the given predicate. // // Returns true if any elements were removed RemoveIf(filter Predicate[E]) bool // Removes from this collection all of its elements that are contained in the specified collection. // // Returns true if this collection changed as a result of the call RemoveAll(Collection[E]) bool // Returns the number of elements in this collection. Size() int // Returns a sequential Stream with this collection as its source. Stream() Stream[E] // Returns an array containing all of the elements in this collection. ToArray() []E }
type Collector ¶
type Collector[T, A, R any] interface { // A function that folds a value into a mutable result container. Accumulator() BiConsumer[A, T] // A function that accepts two partial results and merges them. Combiner() func(a, b A) A // Perform the final transformation from the intermediate accumulation type A to the final result type R. Finisher() func(A) R // A function that creates and returns a new mutable result container. Supplier() Supplier[A] }
type Iterator ¶
type Iterator[E any] interface { // Performs the given action for each remaining element until // all elements have been processed or the action throws an exception. ForEachRemaining(action Consumer[E]) // Returns true if the iteration has more elements. HasNext() bool // Returns the next element in the iteration. Next() E }
type List ¶
type List[E comparable] interface { Collection[E] // Returns the index of the first occurrence of the specified element in this list, // or -1 if this list does not contain the element. IndexOf(E) int // Removes the element at the specified position in this list. RemoveByIndex(index int) E // Replaces the element at the specified position in this list with the specified element. Set(index int, element E) E // Returns the element at the specified position in this list. Get(index int) E }
type Optional ¶
type Optional[T any] interface { // If a value is present, and the value matches the given predicate, returns an Optional describing the value, otherwise returns an empty Optional. Filter(predicate Predicate[T]) Optional[T] // If a value is present, performs the given action with the value, otherwise does nothing. IfPresent(action Consumer[T]) // If a value is present, performs the given action with the value, otherwise performs the given empty-based action. IfPresentOrElse(action Consumer[T], emptyAction func()) // If a value is not present, returns true, otherwise false. IsEmpty() bool // If a value is present, returns true, otherwise false. IsPresent() bool // If a value is present, returns an Optional describing the value, otherwise returns an Optional produced by the supplying function. Or(supplier Supplier[Optional[T]]) Optional[T] // If a value is present, returns the value, otherwise returns other. OrElse(other T) T // If a value is present, returns the value, otherwise returns the result produced by the supplying function. OrElseGet(supplier Supplier[T]) T // If a value is present, returns the value, otherwise panics. OrElsePanic() T }
type Predicate ¶
type Predicate[T any] interface { // Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another. And(Predicate[T]) Predicate[T] // Returns a predicate that represents the logical negation of this predicate. Negate() Predicate[T] // Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another. Or(Predicate[T]) Predicate[T] // Evaluates this predicate on the given argument. Test(T) bool }
type Set ¶
type Set[T comparable] interface { Collection[T] // Adds the specified element to this set if it is not already present. // // Returns true if this set did not already contain the specified element Add(T) bool // Adds all of the elements in the specified collection to this set if they're not already present. // // Returns true if this set changed as a result of the call AddAll(Collection[T]) bool // Removes all of the elements from this set. Clear() // Returns true if this set contains the specified element. Contains(T) bool // Returns true if this set contains all of the elements of the specified collection. ContainsAll(Collection[T]) bool // Returns true if this set contains no elements. IsEmpty() bool // Returns the number of elements in this set (its cardinality). Size() int // Returns an array containing all of the elements in this set. ToArray() []T // Removes the specified element from this set if it is present. // // Returns true if this set contained the specified element Remove(T) bool // Removes from this set all of its elements that are contained in the specified collection. // // Returns true if this set changed as a result of the call RemoveAll(Collection[T]) bool // Retains only the elements in this set that are contained in the specified collection. // // Returns true if this set changed as a result of the call RetainAll(Collection[T]) bool }
type Stream ¶
type Stream[T any] interface { // Returns whether all elements of this stream match the provided predicate. AllMatch(predicate Predicate[T]) bool // Returns whether any elements of this stream match the provided predicate. AnyMatch(predicate Predicate[T]) bool // Creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream. Concat(stream Stream[T]) Stream[T] // Returns the count of elements in this stream. Count() int // Returns, if this stream is ordered, a stream consisting of the remaining elements of this stream after dropping the longest prefix of elements that match the given predicate. DropWhile(predicate Predicate[T]) Stream[T] // Returns a stream consisting of the elements of this stream that match the given predicate. Filter(predicate Predicate[T]) Stream[T] // Performs an action for each element of this stream. ForEach(action func(T)) Map(mapFn func(T) T) Stream[T] //Performs a reduction on the elements of this stream, using an associative accumulation function, and returns an Optional describing the reduced value, if any. Reduce(accumulator BiFunction[T, T, T]) Optional[T] ToList() []T }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.