GeneralIterableExtensions<T extends Object> extension
General-purpose aggregation, windowing, and frequency helpers for iterables.
- on
-
- Iterable<
T>
- Iterable<
Methods
-
chunks(
int size) → Iterable< List< T> > -
Available on Iterable<
Splits this iterable into chunks of sizeT> , provided by the GeneralIterableExtensions extensionsize. -
containsAll(
Iterable< T> other) → bool -
Available on Iterable<
Returns true if this iterable contains all elements fromT> , provided by the GeneralIterableExtensions extensionother. -
countWhere(
ElementPredicate< T> predicate) → int -
Available on Iterable<
Returns the number of elements that satisfy the givenT> , provided by the GeneralIterableExtensions extensionpredicate. -
dedupeConsecutive(
) → Iterable< T> -
Available on Iterable<
Removes consecutive duplicate elements (keeps first of each run).T> , provided by the GeneralIterableExtensions extension -
distinctBy<
K> (K keyOf(T)) → List< T> -
Available on Iterable<
Distinct elements by key; keeps first occurrence of each key.T> , provided by the GeneralIterableExtensions extension -
groupBy<
K> (K keyOf(T)) → Map< K, List< T> > -
Available on Iterable<
Groups elements by the key produced byT> , provided by the GeneralIterableExtensions extensionkeyOf. -
leastOccurrences(
) → Occurrence< T> ? -
Available on Iterable<
Returns an Occurrence of the least common value and its frequency, orT> , provided by the GeneralIterableExtensions extensionnullif the iterable is empty. -
mostOccurrences(
) → Occurrence< T> ? -
Available on Iterable<
Finds the most common value in the list.T> , provided by the GeneralIterableExtensions extension -
partition(
ElementPredicate< T> predicate) → (List<T> , List<T> ) -
Available on Iterable<
Partitions elements into two lists: those that satisfyT> , provided by the GeneralIterableExtensions extensionpredicateand those that do not. -
randomElement(
) → T? -
Available on Iterable<
Returns a random element from this iterable.T> , provided by the GeneralIterableExtensions extension -
skipEveryNth(
int n) → Iterable< T> -
Available on Iterable<
Skips everyT> , provided by the GeneralIterableExtensions extensionn-th element.nmust be positive. -
slidingWindow(
int windowSize) → Iterable< List< T> > -
Available on Iterable<
Sliding windows of sizeT> , provided by the GeneralIterableExtensions extensionwindowSize. Each window is a list ofwindowSizeelements. -
sortBy<
K extends Comparable< (K> >K keyOf(T)) → List< T> -
Available on Iterable<
Sorts byT> , provided by the GeneralIterableExtensions extensionkeyOfand returns a new list.keyOfmust return Comparable. -
takeEveryNth(
int n) → Iterable< T> -
Available on Iterable<
Takes everyT> , provided by the GeneralIterableExtensions extensionn-th element (1-based: first, then 1+n, 1+2n, ...).nmust be positive. -
zipWithIndex(
) → Iterable< (int, T)> -
Available on Iterable<
Zip with index:T> , provided by the GeneralIterableExtensions extension(0, e0), (1, e1), ....