semantic-typescript 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collectable.js +46 -0
- package/dist/collector.d.ts +8 -8
- package/dist/collector.js +113 -47
- package/dist/factory.d.ts +38 -8
- package/dist/factory.js +87 -5
- package/dist/guard.d.ts +7 -4
- package/dist/guard.js +19 -7
- package/dist/hook.d.ts +1 -0
- package/dist/hook.js +51 -8
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/optional.js +36 -3
- package/dist/semantic.d.ts +15 -4
- package/dist/semantic.js +69 -59
- package/dist/statistics.js +30 -0
- package/dist/window.js +10 -0
- package/package.json +1 -1
- package/readme.cn.md +732 -210
- package/readme.md +339 -240
package/readme.md
CHANGED
|
@@ -134,6 +134,7 @@ let comparator: Comparator<number> = (a: number, b: number): number => a - b;
|
|
|
134
134
|
| `isBigIntStatistics(t: unknown): t is BigIntStatistics<unknown>` | Check if it is a BigIntStatistics instance | O(1) | O(1) |
|
|
135
135
|
| `isPromise(t: unknown): t is Promise<unknown>` | Check if it is a Promise object | O(1) | O(1) |
|
|
136
136
|
| `isAsyncFunction(t: unknown): t is AsyncFunction` | Check if it is an AsyncFunction | O(1) | O(1) |
|
|
137
|
+
| `isGenerator(t: unknown): t is Generator<unknown>` | Check if it is a Generator | O(1) | O(1) |
|
|
137
138
|
| `isGeneratorFunction(t: unknown): t is GeneratorFunction` | Check if it is a GeneratorFunction | O(1) | O(1) |
|
|
138
139
|
| `isAsyncGeneratorFunction(t: unknown): t is AsyncGeneratorFunction` | Check if it is an AsyncGeneratorFunction | O(1) | O(1) |
|
|
139
140
|
|
|
@@ -163,7 +164,7 @@ if(isIterable(value)){
|
|
|
163
164
|
|------|------|------------|------------|
|
|
164
165
|
| `useCompare<T>(t1: T, t2: T): number` | Generic comparison function | O(1) | O(1) |
|
|
165
166
|
| `useRandom<T = number \| bigint>(index: T): T` | Pseudo-random number generator | O(log n) | O(1) |
|
|
166
|
-
| `useTraverse(t, callback)` | Deep traverse an object without cyclic references | O(n) | O(1) |
|
|
167
|
+
| `useTraverse(t, callback: BiPredicate<keyof T, T[keyof T]>): void` | Deep traverse an object without cyclic references | O(n) | O(1) |
|
|
167
168
|
| `useToNumber(t: unknown): number` | Convert a value to a number | O(1) | O(1) |
|
|
168
169
|
| `useToBigInt(t: unknown): bigint` | Convert a value to a BigInt | O(1) | O(1) |
|
|
169
170
|
|
|
@@ -208,10 +209,10 @@ let resolvedBigInt: bigint = useToBigInt(toBeResolved); // 5n
|
|
|
208
209
|
|
|
209
210
|
| Method | Description | Time Complexity | Space Complexity |
|
|
210
211
|
|------|------|------------|------------|
|
|
211
|
-
| `Optional.empty<T>()
|
|
212
|
-
| `Optional.of<T>(value)
|
|
213
|
-
| `Optional.ofNullable<T>(value)
|
|
214
|
-
| `Optional.ofNonNull<T>(value)
|
|
212
|
+
| `Optional.empty<T>(): Optional<T>` | Create an empty Optional | O(1) | O(1) |
|
|
213
|
+
| `Optional.of<T>(value): Optional<T>` | Create an Optional containing a value | O(1) | O(1) |
|
|
214
|
+
| `Optional.ofNullable<T>(value): Optional<T>` | Create a potentially empty Optional | O(1) | O(1) |
|
|
215
|
+
| `Optional.ofNonNull<T>(value): Optional<T>` | Create a non-null Optional | O(1) | O(1) |
|
|
215
216
|
|
|
216
217
|
```typescript
|
|
217
218
|
// Optional usage examples
|
|
@@ -228,76 +229,93 @@ console.log(empty.get(100)); // Outputs 100
|
|
|
228
229
|
|
|
229
230
|
| Method | Description | Time Complexity | Space Complexity |
|
|
230
231
|
|------|------|------------|------------|
|
|
231
|
-
| `Collector.full(identity
|
|
232
|
-
| `Collector.
|
|
233
|
-
| `
|
|
234
|
-
| `
|
|
235
|
-
| `
|
|
236
|
-
| `
|
|
237
|
-
| `
|
|
238
|
-
| `
|
|
239
|
-
| `
|
|
240
|
-
| `
|
|
241
|
-
| `
|
|
242
|
-
| `
|
|
243
|
-
| `
|
|
244
|
-
| `
|
|
245
|
-
| `
|
|
246
|
-
| `
|
|
247
|
-
| `
|
|
248
|
-
| `
|
|
249
|
-
| `
|
|
250
|
-
| `
|
|
251
|
-
| `
|
|
252
|
-
| `
|
|
253
|
-
| `
|
|
254
|
-
| `
|
|
255
|
-
| `
|
|
256
|
-
| `
|
|
257
|
-
| `
|
|
258
|
-
| `
|
|
259
|
-
| `
|
|
260
|
-
| `
|
|
261
|
-
| `
|
|
262
|
-
| `
|
|
263
|
-
| `
|
|
264
|
-
| `
|
|
265
|
-
| `
|
|
266
|
-
| `
|
|
267
|
-
| `
|
|
268
|
-
| `
|
|
269
|
-
| `
|
|
270
|
-
| `
|
|
271
|
-
| `
|
|
272
|
-
| `
|
|
273
|
-
| `
|
|
274
|
-
| `
|
|
275
|
-
| `
|
|
276
|
-
| `
|
|
277
|
-
| `
|
|
278
|
-
| `
|
|
279
|
-
| `
|
|
280
|
-
| `
|
|
281
|
-
| `
|
|
282
|
-
| `
|
|
283
|
-
| `
|
|
284
|
-
| `
|
|
285
|
-
| `
|
|
286
|
-
| `
|
|
287
|
-
| `
|
|
288
|
-
| `
|
|
289
|
-
| `
|
|
290
|
-
| `
|
|
291
|
-
| `
|
|
292
|
-
| `
|
|
293
|
-
| `
|
|
294
|
-
| `
|
|
295
|
-
| `
|
|
296
|
-
| `
|
|
297
|
-
| `
|
|
298
|
-
| `
|
|
299
|
-
| `
|
|
300
|
-
| `
|
|
232
|
+
| `Collector.full(identity: Supplier<A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Create a full collector | O(1) | O(1) |
|
|
233
|
+
| `Collector.full(identity: Supplier<A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Create a full collector | O(1) | O(1) |
|
|
234
|
+
| `Collector.shortable(identity: Supplier<A>, interruptor: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Create an interruptible collector | O(1) | O(1) |
|
|
235
|
+
| `Collector.shortable(identity: Supplier<A>, interruptor: Predicate<E>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Create an interruptible collector | O(1) | O(1) |
|
|
236
|
+
| `Collector.shortable(identity: Supplier<A>, interruptor: BiPredicate<E, bigint>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Create an interruptible collector | O(1) | O(1) |
|
|
237
|
+
| `Collector.shortable(identity: Supplier<A>, interruptor: BiPredicate<E, bigint>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Create an interruptible collector | O(1) | O(1) |
|
|
238
|
+
| `Collector.shortable(identity: Supplier<A>, interruptor: TriPredicate<E, bigint, A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Create an interruptible collector | O(1) | O(1) |
|
|
239
|
+
| `Collector.shortable(identity: Supplier<A>, interruptor: TriPredicate<E, bigint, A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Create an interruptible collector | O(1) | O(1) |
|
|
240
|
+
| `useAnyMatch<E>(predicate: Predicate<E>): Collector<E, boolean, boolean>` | Creates a collector that checks if any element matches the predicate | `predicate: Predicate<E>` | `Collector<E, boolean, boolean>` |
|
|
241
|
+
| `useAllMatch<E>(predicate: Predicate<E>): Collector<E, boolean, boolean>` | Creates a collector that checks if all elements match the predicate | `predicate: Predicate<E>` | `Collector<E, boolean, boolean>` |
|
|
242
|
+
| `useCollect<E, A, R>(identity: Supplier<A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Creates a full collector | `identity: Supplier<A>`, `accumulator: BiFunctional<A, E, A>`, `finisher: Functional<A, R>` | `Collector<E, A, R>` |
|
|
243
|
+
| `useCollect<E, A, R>(identity: Supplier<A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Creates a full collector | `identity: Supplier<A>`, `accumulator: TriFunctional<A, E, bigint, A>`, `finisher: Functional<A, R>` | `Collector<E, A, R>` |
|
|
244
|
+
| `useCollect<E, A, R>(identity: Supplier<A>, interruptor: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Creates an interruptible collector | `identity: Supplier<A>`, `interruptor: Predicate<E>`, `accumulator: BiFunctional<A, E, A>`, `finisher: Functional<A, R>` | `Collector<E, A, R>` |
|
|
245
|
+
| `useCollect<E, A, R>(identity: Supplier<A>, interruptor: Predicate<E>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Creates an interruptible collector | `identity: Supplier<A>`, `interruptor: Predicate<E>`, `accumulator: TriFunctional<A, E, bigint, A>`, `finisher: Functional<A, R>` | `Collector<E, A, R>` |
|
|
246
|
+
| `useCollect<E, A, R>(identity: Supplier<A>, interruptor: BiPredicate<E, bigint>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Creates an interruptible collector | `identity: Supplier<A>`, `interruptor: BiPredicate<E, bigint>`, `accumulator: BiFunctional<A, E, A>`, `finisher: Functional<A, R>` | `Collector<E, A, R>` |
|
|
247
|
+
| `useCollect<E, A, R>(identity: Supplier<A>, interruptor: BiPredicate<E, bigint>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Creates an interruptible collector | `identity: Supplier<A>`, `interruptor: BiPredicate<E, bigint>`, `accumulator: TriFunctional<A, E, bigint, A>`, `finisher: Functional<A, R>` | `Collector<E, A, R>` |
|
|
248
|
+
| `useCollect<E, A, R>(identity: Supplier<A>, interruptor: TriPredicate<E, bigint, A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Creates an interruptible collector | `identity: Supplier<A>`, `interruptor: TriPredicate<E, bigint, A>`, `accumulator: BiFunctional<A, E, A>`, `finisher: Functional<A, R>` | `Collector<E, A, R>` |
|
|
249
|
+
| `useCollect<E, A, R>(identity: Supplier<A>, interruptor: TriPredicate<E, bigint, A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>` | Creates an interruptible collector | `identity: Supplier<A>`, `interruptor: TriPredicate<E, bigint, A>`, `accumulator: TriFunctional<A, E, bigint, A>`, `finisher: Functional<A, R>` | `Collector<E, A, R>` |
|
|
250
|
+
| `useCount<E = unknown>(): Collector<E, bigint, bigint>` | Creates a collector that counts elements | None | `Collector<E, bigint, bigint>` |
|
|
251
|
+
| `useError<E = unknown>(): Collector<E, string, string>` | Creates a collector that accumulates errors to console.error | None | `Collector<E, string, string>` |
|
|
252
|
+
| `useError<E = unknown>(accumulator: BiFunctional<string, E, string>): Collector<E, string, string>` | Creates a collector that accumulates errors with custom accumulator | `accumulator: BiFunctional<string, E, string>` | `Collector<E, string, string>` |
|
|
253
|
+
| `useError<E = unknown>(accumulator: TriFunctional<string, E, bigint, string>): Collector<E, string, string>` | Creates a collector that accumulates errors with custom accumulator | `accumulator: TriFunctional<string, E, bigint, string>` | `Collector<E, string, string>` |
|
|
254
|
+
| `useError<E = unknown>(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): Collector<E, string, string>` | Creates a collector that accumulates errors with prefix and suffix | `prefix: string`, `accumulator: BiFunctional<string, E, string>`, `suffix: string` | `Collector<E, string, string>` |
|
|
255
|
+
| `useError<E = unknown>(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): Collector<E, string, string>` | Creates a collector that accumulates errors with prefix and suffix | `prefix: string`, `accumulator: TriFunctional<string, E, bigint, string>`, `suffix: string` | `Collector<E, string, string>` |
|
|
256
|
+
| `useFindFirst<E>(): Collector<E, Optional<E>, Optional<E>>` | Creates a collector that finds the first element | None | `Collector<E, Optional<E>, Optional<E>>` |
|
|
257
|
+
| `useFindAny<E>(): Collector<E, Optional<E>, Optional<E>>` | Creates a collector that finds any element randomly | None | `Collector<E, Optional<E>, Optional<E>>` |
|
|
258
|
+
| `useFindLast<E>(): Collector<E, Optional<E>, Optional<E>>` | Creates a collector that finds the last element | None | `Collector<E, Optional<E>, Optional<E>>` |
|
|
259
|
+
| `useFindMaximum<E>(): Collector<E, Optional<E>, Optional<E>>` | Creates a collector that finds the maximum element | None | `Collector<E, Optional<E>, Optional<E>>` |
|
|
260
|
+
| `useFindMaximum<E>(comparator: Comparator<E>): Collector<E, Optional<E>, Optional<E>>` | Creates a collector that finds the maximum element with custom comparator | `comparator: Comparator<E>` | `Collector<E, Optional<E>, Optional<E>>` |
|
|
261
|
+
| `useFindMinimum<E>(): Collector<E, Optional<E>, Optional<E>>` | Creates a collector that finds the minimum element | None | `Collector<E, Optional<E>, Optional<E>>` |
|
|
262
|
+
| `useFindMinimum<E>(comparator: Comparator<E>): Collector<E, Optional<E>, Optional<E>>` | Creates a collector that finds the minimum element with custom comparator | `comparator: Comparator<E>` | `Collector<E, Optional<E>, Optional<E>>` |
|
|
263
|
+
| `useForEach<E>(action: Consumer<E>): Collector<E, bigint, bigint>` | Creates a collector that performs an action on each element | `action: Consumer<E>` | `Collector<E, bigint, bigint>` |
|
|
264
|
+
| `useForEach<E>(action: BiConsumer<E, bigint>): Collector<E, bigint, bigint>` | Creates a collector that performs an action on each element with index | `action: BiConsumer<E, bigint>` | `Collector<E, bigint, bigint>` |
|
|
265
|
+
| `useNoneMatch<E>(predicate: Predicate<E>): Collector<E, boolean, boolean>` | Creates a collector that checks if no element matches the predicate | `predicate: Predicate<E>` | `Collector<E, boolean, boolean>` |
|
|
266
|
+
| `useGroup<E, K>(classifier: Functional<E, K>): Collector<E, Map<K, E[]>, Map<K, E[]>>` | Creates a collector that groups elements by classifier | `classifier: Functional<E, K>` | `Collector<E, Map<K, E[]>, Map<K, E[]>>` |
|
|
267
|
+
| `useGroupBy<E, K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Collector<E, Map<K, V[]>, Map<K, V[]>>` | Creates a collector that groups elements by key and extracts values | `keyExtractor: Functional<E, K>`, `valueExtractor: Functional<E, V>` | `Collector<E, Map<K, V[]>, Map<K, V[]>>` |
|
|
268
|
+
| `useJoin<E = unknown>(): Collector<E, string, string>` | Creates a collector that joins elements into a string | None | `Collector<E, string, string>` |
|
|
269
|
+
| `useJoin<E = unknown>(delimiter: string): Collector<E, string, string>` | Creates a collector that joins elements with delimiter | `delimiter: string` | `Collector<E, string, string>` |
|
|
270
|
+
| `useJoin<E = unknown>(prefix: string, delimiter: string, suffix: string): Collector<E, string, string>` | Creates a collector that joins elements with prefix, delimiter, and suffix | `prefix: string`, `delimiter: string`, `suffix: string` | `Collector<E, string, string>` |
|
|
271
|
+
| `useJoin<E = unknown>(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): Collector<E, string, string>` | Creates a collector that joins elements with custom accumulator | `prefix: string`, `accumulator: BiFunctional<string, E, string>`, `suffix: string` | `Collector<E, string, string>` |
|
|
272
|
+
| `useJoin<E = unknown>(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): Collector<E, string, string>` | Creates a collector that joins elements with custom accumulator | `prefix: string`, `accumulator: TriFunctional<string, E, bigint, string>`, `suffix: string` | `Collector<E, string, string>` |
|
|
273
|
+
| `useLog<E = unknown>(): Collector<E, string, string>` | Creates a collector that accumulates logs to console.log | None | `Collector<E, string, string>` |
|
|
274
|
+
| `useLog<E = unknown>(accumulator: BiFunctional<string, E, string>): Collector<E, string, string>` | Creates a collector that accumulates logs with custom accumulator | `accumulator: BiFunctional<string, E, string>` | `Collector<E, string, string>` |
|
|
275
|
+
| `useLog<E = unknown>(accumulator: TriFunctional<string, E, bigint, string>): Collector<E, string, string>` | Creates a collector that accumulates logs with custom accumulator | `accumulator: TriFunctional<string, E, bigint, string>` | `Collector<E, string, string>` |
|
|
276
|
+
| `useLog<E = unknown>(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): Collector<E, string, string>` | Creates a collector that accumulates logs with prefix and suffix | `prefix: string`, `accumulator: BiFunctional<string, E, string>`, `suffix: string` | `Collector<E, string, string>` |
|
|
277
|
+
| `useLog<E = unknown>(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): Collector<E, string, string>` | Creates a collector that accumulates logs with prefix and suffix | `prefix: string`, `accumulator: TriFunctional<string, E, bigint, string>`, `suffix: string` | `Collector<E, string, string>` |
|
|
278
|
+
| `usePartition<E>(count: bigint): Collector<E, Array<Array<E>>, Array<Array<E>>>` | Creates a collector that partitions elements into groups | `count: bigint` | `Collector<E, Array<Array<E>>, Array<Array<E>>>` |
|
|
279
|
+
| `usePartitionBy<E>(classifier: Functional<E, bigint>): Collector<E, Array<E[]>, Array<E[]>>` | Creates a collector that partitions elements by classifier | `classifier: Functional<E, bigint>` | `Collector<E, Array<E[]>, Array<E[]>>` |
|
|
280
|
+
| `useReduce<E>(accumulator: BiFunctional<E, E, E>): Collector<E, Optional<E>, Optional<E>>` | Creates a collector that reduces elements | `accumulator: BiFunctional<E, E, E>` | `Collector<E, Optional<E>, Optional<E>>` |
|
|
281
|
+
| `useReduce<E>(accumulator: TriFunctional<E, E, bigint, E>): Collector<E, Optional<E>, Optional<E>>` | Creates a collector that reduces elements | `accumulator: TriFunctional<E, E, bigint, E>` | `Collector<E, Optional<E>, Optional<E>>` |
|
|
282
|
+
| `useReduce<E>(identity: E, accumulator: BiFunctional<E, E, E>): Collector<E, E, E>` | Creates a collector that reduces elements with identity | `identity: E`, `accumulator: BiFunctional<E, E, E>` | `Collector<E, E, E>` |
|
|
283
|
+
| `useReduce<E>(identity: E, accumulator: TriFunctional<E, E, bigint, E>): Collector<E, E, E>` | Creates a collector that reduces elements with identity | `identity: E`, `accumulator: TriFunctional<E, E, bigint, E>` | `Collector<E, E, E>` |
|
|
284
|
+
| `useReduce<E, R>(identity: R, accumulator: BiFunctional<R, E, R>, finisher: Functional<R, R>): Collector<E, R, R>` | Creates a collector that reduces elements with identity and finisher | `identity: R`, `accumulator: BiFunctional<R, E, R>`, `finisher: Functional<R, R>` | `Collector<E, R, R>` |
|
|
285
|
+
| `useReduce<E, R>(identity: R, accumulator: TriFunctional<R, E, bigint, R>, finisher: Functional<R, R>): Collector<E, R, R>` | Creates a collector that reduces elements with identity and finisher | `identity: R`, `accumulator: TriFunctional<R, E, bigint, R>`, `finisher: Functional<R, R>` | `Collector<E, R, R>` |
|
|
286
|
+
| `useToArray<E>(): Collector<E, E[], E[]>` | Creates a collector that accumulates elements into an array | None | `Collector<E, E[], E[]>` |
|
|
287
|
+
| `useToMap<E, K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Collector<E, Map<K, V>, Map<K, V>>` | Creates a collector that accumulates elements into a map | `keyExtractor: Functional<E, K>`, `valueExtractor: Functional<E, V>` | `Collector<E, Map<K, V>, Map<K, V>>` |
|
|
288
|
+
| `useToSet<E>(): Collector<E, Set<E>, Set<E>>` | Creates a collector that accumulates elements into a set | None | `Collector<E, Set<E>, Set<E>>` |
|
|
289
|
+
| `useWrite<E, S = string>(stream: WritableStream<S>): Collector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>` | Creates a collector that writes elements to a stream | `stream: WritableStream<S>` | `Collector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>` |
|
|
290
|
+
| `useWrite<E, S = string>(stream: WritableStream<S>, accumulator: BiFunctional<WritableStream<S>, E, WritableStream<S>>): Collector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>` | Creates a collector that writes elements to a stream with custom accumulator | `stream: WritableStream<S>`, `accumulator: BiFunctional<WritableStream<S>, E, WritableStream<S>>` | `Collector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>` |
|
|
291
|
+
| `useWrite<E, S = string>(stream: WritableStream<S>, accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>): Collector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>` | Creates a collector that writes elements to a stream with custom accumulator | `stream: WritableStream<S>`, `accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>` | `Collector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>` |
|
|
292
|
+
| `useNumericSummate<E>(): Collector<E, number, number>` | Creates a collector that sums numeric values | None | `Collector<number, number, number>` or `Collector<E, number, number>` |
|
|
293
|
+
| `useNumericSummate<E>(mapper: Functional<E, number>): Collector<E, number, number>` | Creates a collector that sums mapped numeric values | `mapper: Functional<E, number>` | `Collector<E, number, number>` |
|
|
294
|
+
| `useBigIntSummate<E>(): Collector<E, bigint, bigint>` | Creates a collector that sums bigint values | None | `Collector<bigint, bigint, bigint>` or `Collector<E, bigint, bigint>` |
|
|
295
|
+
| `useBigIntSummate<E>(mapper: Functional<E, bigint>): Collector<E, bigint, bigint>` | Creates a collector that sums mapped bigint values | `mapper: Functional<E, bigint>` | `Collector<E, bigint, bigint>` |
|
|
296
|
+
| `useNumericAverage<E>(): Collector<E, NumericAverageAccumulator, number>` | Creates a collector that calculates numeric average | None | `Collector<number, NumericAverageAccumulator, number>` or `Collector<E, NumericAverageAccumulator, number>` |
|
|
297
|
+
| `useNumericAverage<E>(mapper: Functional<E, number>): Collector<E, NumericAverageAccumulator, number>` | Creates a collector that calculates numeric average of mapped values | `mapper: Functional<E, number>` | `Collector<E, NumericAverageAccumulator, number>` |
|
|
298
|
+
| `useBigIntAverage<E>(): Collector<E, BigIntAverageAccumulator, bigint>` | Creates a collector that calculates bigint average | None | `Collector<bigint, BigIntAverageAccumulator, bigint>` or `Collector<E, BigIntAverageAccumulator, bigint>` |
|
|
299
|
+
| `useBigIntAverage<E>(mapper: Functional<E, bigint>): Collector<E, BigIntAverageAccumulator, bigint>` | Creates a collector that calculates bigint average of mapped values | `mapper: Functional<E, bigint>` | `Collector<E, BigIntAverageAccumulator, bigint>` |
|
|
300
|
+
| `useFrequency<E>(): Collector<E, Map<E, bigint>, Map<E, bigint>>` | Creates a collector that counts frequency of elements | None | `Collector<E, Map<E, bigint>, Map<E, bigint>>` |
|
|
301
|
+
| `useNumericMode<E>(): Collector<E, Map<number, bigint>, number>` | Creates a collector that finds numeric mode | None | `Collector<number, Map<number, bigint>, number>` or `Collector<E, Map<number, bigint>, number>` |
|
|
302
|
+
| `useNumericMode<E>(mapper: Functional<E, number>): Collector<E, Map<number, bigint>, number>` | Creates a collector that finds numeric mode of mapped values | `mapper: Functional<E, number>` | `Collector<E, Map<number, bigint>, number>` |
|
|
303
|
+
| `useBigIntMode<E>(): Collector<E, Map<bigint, bigint>, bigint>` | Creates a collector that finds bigint mode | None | `Collector<bigint, Map<bigint, bigint>, bigint>` or `Collector<E, Map<bigint, bigint>, bigint>` |
|
|
304
|
+
| `useBigIntMode<E>(mapper: Functional<E, bigint>): Collector<E, Map<bigint, bigint>, bigint>` | Creates a collector that finds bigint mode of mapped values | `mapper: Functional<E, bigint>` | `Collector<E, Map<bigint, bigint>, bigint>` |
|
|
305
|
+
| `useNumericVariance<E>(): Collector<E, VarianceAccumulator, number>` | Creates a collector that calculates numeric variance | None | `Collector<number, VarianceAccumulator, number>` or `Collector<E, VarianceAccumulator, number>` |
|
|
306
|
+
| `useNumericVariance<E>(mapper: Functional<E, number>): Collector<E, VarianceAccumulator, number>` | Creates a collector that calculates numeric variance of mapped values | `mapper: Functional<E, number>` | `Collector<E, VarianceAccumulator, number>` |
|
|
307
|
+
| `useBigIntVariance<E>(): Collector<E, BigIntVarianceAccumulator, bigint>` | Creates a collector that calculates bigint variance | None | `Collector<bigint, BigIntVarianceAccumulator, bigint>` or `Collector<E, BigIntVarianceAccumulator, bigint>` |
|
|
308
|
+
| `useBigIntVariance<E>(mapper: Functional<E, bigint>): Collector<E, BigIntVarianceAccumulator, bigint>` | Creates a collector that calculates bigint variance of mapped values | `mapper: Functional<E, bigint>` | `Collector<E, BigIntVarianceAccumulator, bigint>` |
|
|
309
|
+
| `useNumericStandardDeviation<E>(): Collector<E, StandardDeviationAccumulator, number>` | Creates a collector that calculates numeric standard deviation | None | `Collector<number, StandardDeviationAccumulator, number>` or `Collector<E, StandardDeviationAccumulator, number>` |
|
|
310
|
+
| `useNumericStandardDeviation<E>(mapper: Functional<E, number>): Collector<E, StandardDeviationAccumulator, number>` | Creates a collector that calculates numeric standard deviation of mapped values | `mapper: Functional<E, number>` | `Collector<E, StandardDeviationAccumulator, number>` |
|
|
311
|
+
| `useBigIntStandardDeviation<E>(): Collector<E, BigIntStandardDeviationAccumulator, bigint>` | Creates a collector that calculates bigint standard deviation | None | `Collector<bigint, BigIntStandardDeviationAccumulator, bigint>` or `Collector<E, BigIntStandardDeviationAccumulator, bigint>` |
|
|
312
|
+
| `useBigIntStandardDeviation<E>(mapper: Functional<E, bigint>): Collector<E, BigIntStandardDeviationAccumulator, bigint>` | Creates a collector that calculates bigint standard deviation of mapped values | `mapper: Functional<E, bigint>` | `Collector<E, BigIntStandardDeviationAccumulator, bigint>` |
|
|
313
|
+
| `useNumericMedian<E>(): Collector<E, number[], number>` | Creates a collector that calculates numeric median | None | `Collector<number, number[], number>` or `Collector<E, number[], number>` |
|
|
314
|
+
| `useNumericMedian<E>(mapper: Functional<E, number>): Collector<E, number[], number>` | Creates a collector that calculates numeric median of mapped values | `mapper: Functional<E, number>` | `Collector<E, number[], number>` |
|
|
315
|
+
| `useBigIntMedian<E>(): Collector<E, bigint[], bigint>` | Creates a collector that calculates bigint median | None | `Collector<bigint, bigint[], bigint>` or `Collector<E, bigint[], bigint>` |
|
|
316
|
+
| `useBigIntMedian<E>(mapper: Functional<E, bigint>): Collector<E, bigint[], bigint>` | Creates a collector that calculates bigint median of mapped values | `mapper: Functional<E, bigint>` | `Collector<E, bigint[], bigint>` |
|
|
317
|
+
| `useToGeneratorFunction<E>(): Collector<E, Array<E>, globalThis.Generator<E, void, undefined>>` | Creates a collector that converts elements to a generator function | None | `Collector<E, Array<E>, globalThis.Generator<E, void, undefined>>` |
|
|
318
|
+
| `useToAsyncGeneratorFunction<E>(): Collector<E, Array<E>, globalThis.AsyncGenerator<E, void, undefined>>` | Creates a collector that converts elements to an async generator function | None | `Collector<E, Array<E>, globalThis.AsyncGenerator<E, void, undefined>>` |
|
|
301
319
|
|
|
302
320
|
```typescript
|
|
303
321
|
// Collector conversion examples
|
|
@@ -336,29 +354,39 @@ average.collect([1,2,3,4,5]); // Averages from an iterable object
|
|
|
336
354
|
## Collector Class Methods
|
|
337
355
|
|
|
338
356
|
| Method | Description | Time Complexity | Space Complexity |
|
|
339
|
-
|
|
340
|
-
| `collect(
|
|
341
|
-
| `collect(iterable)` | Collect elements from an iterable object | O(n) | O(1) |
|
|
342
|
-
| `collect(
|
|
343
|
-
| `collect(
|
|
344
|
-
| `collect(
|
|
345
|
-
| `collect(start,
|
|
357
|
+
|--------|-------------|-----------------|------------------|
|
|
358
|
+
| `collect(generator: Generator<E>): R` | Collect elements from a generator function | O(n) | O(1) |
|
|
359
|
+
| `collect(iterable: Iterable<E>): R` | Collect elements from an iterable object | O(n) | O(1) |
|
|
360
|
+
| `collect(semantic: Semantic<E>): R` | Collect elements from a semantic stream | O(n) | O(1) |
|
|
361
|
+
| `collect(collectable: Collectable<E>): R` | Collect elements from a collectable stream | O(n) | O(1) |
|
|
362
|
+
| `collect(start: number, end: number): R` | Collect elements from a numeric range | O(n) | O(1) |
|
|
363
|
+
| `collect(start: bigint, end: bigint): R` | Collect elements from a bigint range | O(n) | O(1) |
|
|
346
364
|
|
|
347
365
|
### Semantic Factory Methods
|
|
348
366
|
|
|
349
|
-
|
|
|
350
|
-
|
|
351
|
-
| `animationFrame(period: number
|
|
352
|
-
| `
|
|
353
|
-
| `
|
|
354
|
-
| `
|
|
355
|
-
| `
|
|
356
|
-
| `
|
|
357
|
-
| `
|
|
358
|
-
| `
|
|
359
|
-
| `
|
|
360
|
-
| `
|
|
361
|
-
| `
|
|
367
|
+
| Function | Description | Parameters | Return Type |
|
|
368
|
+
|----------|-------------|------------|-------------|
|
|
369
|
+
| `animationFrame(period: number): Semantic<number>` | Creates a semantic that emits animation frame timestamps | `period: number` | `Semantic<number>` |
|
|
370
|
+
| `animationFrame(period: number, delay: number): Semantic<number>` | Creates a semantic that emits animation frame timestamps with delay | `period: number`, `delay: number` | `Semantic<number>` |
|
|
371
|
+
| `attribute<T extends object>(target: T): Semantic<Attribute<T>>` | Creates a semantic that emits object attributes | `target: T` | `Semantic<Attribute<T>>` |
|
|
372
|
+
| `blob(blob: Blob): Semantic<Uint8Array>` | Creates a semantic that emits blob data in chunks | `blob: Blob` | `Semantic<Uint8Array>` |
|
|
373
|
+
| `blob(blob: Blob, chunk: bigint): Semantic<Uint8Array>` | Creates a semantic that emits blob data with custom chunk size | `blob: Blob`, `chunk: bigint` | `Semantic<Uint8Array>` |
|
|
374
|
+
| `empty<E>(): Semantic<E>` | Creates an empty semantic that emits no elements | None | `Semantic<E>` |
|
|
375
|
+
| `fill<E>(element: E, count: bigint): Semantic<E>` | Creates a semantic that emits a repeated element | `element: E`, `count: bigint` | `Semantic<E>` |
|
|
376
|
+
| `fill<E>(supplier: Supplier<E>, count: bigint): Semantic<E>` | Creates a semantic that emits values from a supplier | `supplier: Supplier<E>`, `count: bigint` | `Semantic<E>` |
|
|
377
|
+
| `from<E>(iterable: Iterable<E>): Semantic<E>` | Creates a semantic from an iterable | `iterable: Iterable<E>` | `Semantic<E>` |
|
|
378
|
+
| `from<E>(iterable: AsyncIterable<E>): Semantic<E>` | Creates a semantic from an async iterable | `iterable: AsyncIterable<E>` | `Semantic<E>` |
|
|
379
|
+
| `generate<E>(supplier: Supplier<E>, count: bigint): Semantic<E>` | Creates a semantic that generates a fixed number of values | `supplier: Supplier<E>`, `count: bigint` | `Semantic<E>` |
|
|
380
|
+
| `generate<E>(element: E, count: bigint): Semantic<E>` | Creates a semantic that repeats an element | `element: E`, `count: bigint` | `Semantic<E>` |
|
|
381
|
+
| `generate<E>(supplier: Supplier<E>, interrupt: Predicate<E>): Semantic<E>` | Creates a semantic that generates until condition is met | `supplier: Supplier<E>`, `interrupt: Predicate<E>` | `Semantic<E>` |
|
|
382
|
+
| `generate<E>(supplier: Supplier<E>, interrupt: BiPredicate<E, bigint>): Semantic<E>` | Creates a semantic that generates until condition is met | `supplier: Supplier<E>`, `interrupt: BiPredicate<E, bigint>` | `Semantic<E>` |
|
|
383
|
+
| `interval(period: number): Semantic<number>` | Creates a semantic that emits at regular intervals | `period: number` | `Semantic<number>` |
|
|
384
|
+
| `interval(period: number, delay: number): Semantic<number>` | Creates a semantic that emits at intervals with initial delay | `period: number`, `delay: number` | `Semantic<number>` |
|
|
385
|
+
| `iterate<E>(generator: Generator<E>): Semantic<E>` | Creates a semantic from a generator function | `generator: Generator<E>` | `Semantic<E>` |
|
|
386
|
+
| `promise<T>(promise: Promise<T>): Semantic<T>` | Creates a semantic that emits a promise's result | `promise: Promise<T>` | `Semantic<T>` |
|
|
387
|
+
| `range(start: number, end: number): Semantic<number>` | Creates a semantic that emits a range of numbers | `start: number`, `end: number` | `Semantic<number>` |
|
|
388
|
+
| `range(start: number, end: number, step: number): Semantic<number>` | Creates a semantic that emits a range with custom step | `start: number`, `end: number`, `step: number` | `Semantic<number>` |
|
|
389
|
+
| `websocket(websocket: WebSocket): Semantic<MessageEvent \| CloseEvent \| Event>` | Creates a semantic that emits WebSocket events | `websocket: WebSocket` | `Semantic<MessageEvent \| CloseEvent \| Event>` |
|
|
362
390
|
|
|
363
391
|
```typescript
|
|
364
392
|
// Semantic factory method usage examples
|
|
@@ -407,29 +435,42 @@ websocket(ws)
|
|
|
407
435
|
## Semantic Class Methods
|
|
408
436
|
|
|
409
437
|
| Method | Description | Time Complexity | Space Complexity |
|
|
410
|
-
|
|
411
|
-
| `concat(
|
|
412
|
-
| `concat(
|
|
413
|
-
| `distinct()
|
|
414
|
-
| `distinct(
|
|
415
|
-
| `
|
|
416
|
-
| `
|
|
417
|
-
| `
|
|
418
|
-
| `
|
|
419
|
-
| `
|
|
420
|
-
| `
|
|
421
|
-
| `
|
|
422
|
-
| `
|
|
423
|
-
| `
|
|
424
|
-
| `
|
|
425
|
-
| `
|
|
426
|
-
| `
|
|
427
|
-
| `
|
|
428
|
-
| `
|
|
429
|
-
| `
|
|
430
|
-
| `
|
|
431
|
-
| `
|
|
432
|
-
| `
|
|
438
|
+
|--------|-------------|-----------------|------------------|
|
|
439
|
+
| `concat(other: Semantic<E>): Semantic<E>` | Concatenates two semantics | O(m+n) | O(1) |
|
|
440
|
+
| `concat(other: Iterable<E>): Semantic<E>` | Concatenates semantic with an iterable | O(m+n) | O(1) |
|
|
441
|
+
| `distinct(): Semantic<E>` | Returns distinct elements | O(n) | O(n) |
|
|
442
|
+
| `distinct<K>(keyExtractor: Functional<E, K>): Semantic<E>` | Returns distinct elements by key | O(n) | O(n) |
|
|
443
|
+
| `distinct<K>(keyExtractor: BiFunctional<E, bigint, K>): Semantic<E>` | Returns distinct elements by key with index | O(n) | O(n) |
|
|
444
|
+
| `dropWhile(predicate: Predicate<E>): Semantic<E>` | Drops elements while predicate is true | O(n) | O(1) |
|
|
445
|
+
| `dropWhile(predicate: BiPredicate<E, bigint>): Semantic<E>` | Drops elements while predicate is true with index | O(n) | O(1) |
|
|
446
|
+
| `filter(predicate: Predicate<E>): Semantic<E>` | Filters elements by predicate | O(n) | O(1) |
|
|
447
|
+
| `filter(predicate: BiPredicate<E, bigint>): Semantic<E>` | Filters elements by predicate with index | O(n) | O(1) |
|
|
448
|
+
| `flat(mapper: Functional<E, Iterable<E>>): Semantic<E>` | Flattens iterable results | O(n) | O(1) |
|
|
449
|
+
| `flat(mapper: BiFunctional<E, bigint, Iterable<E>>): Semantic<E>` | Flattens iterable results with index | O(n) | O(1) |
|
|
450
|
+
| `flat(mapper: Functional<E, Semantic<E>>): Semantic<E>` | Flattens semantic results | O(n) | O(1) |
|
|
451
|
+
| `flat(mapper: BiFunctional<E, bigint, Semantic<E>>): Semantic<E>` | Flattens semantic results with index | O(n) | O(1) |
|
|
452
|
+
| `flatMap<R>(mapper: Functional<E, Iterable<R>>): Semantic<R>` | Maps and flattens to different type | O(n) | O(1) |
|
|
453
|
+
| `flatMap<R>(mapper: BiFunctional<E, bigint, Iterable<R>>): Semantic<R>` | Maps and flattens with index | O(n) | O(1) |
|
|
454
|
+
| `flatMap<R>(mapper: Functional<E, Semantic<R>>): Semantic<R>` | Maps and flattens semantics | O(n) | O(1) |
|
|
455
|
+
| `flatMap<R>(mapper: BiFunctional<E, bigint, Semantic<R>>): Semantic<R>` | Maps and flattens semantics with index | O(n) | O(1) |
|
|
456
|
+
| `limit(n: number): Semantic<E>` | Limits number of elements | O(n) | O(1) |
|
|
457
|
+
| `limit(n: bigint): Semantic<E>` | Limits number of elements (bigint) | O(n) | O(1) |
|
|
458
|
+
| `map<R>(mapper: Functional<E, R>): Semantic<R>` | Maps elements to different type | O(n) | O(1) |
|
|
459
|
+
| `map<R>(mapper: BiFunctional<E, bigint, R>): Semantic<R>` | Maps elements with index | O(n) | O(1) |
|
|
460
|
+
| `peek(consumer: Consumer<E>): Semantic<E>` | Performs action on elements | O(n) | O(1) |
|
|
461
|
+
| `peek(consumer: BiConsumer<E, bigint>): Semantic<E>` | Performs action on elements with index | O(n) | O(1) |
|
|
462
|
+
| `redirect(redirector: BiFunctional<E, bigint, bigint>): Semantic<E>` | Redirects element indices | O(n) | O(1) |
|
|
463
|
+
| `reverse(): Semantic<E>` | Reverses element indices | O(n) | O(1) |
|
|
464
|
+
| `shuffle(): Semantic<E>` | Shuffles element indices randomly | O(n) | O(1) |
|
|
465
|
+
| `shuffle(mapper: BiFunctional<E, bigint, bigint>): Semantic<E>` | Shuffles element indices with mapper | O(n) | O(1) |
|
|
466
|
+
| `skip(n: number): Semantic<E>` | Skips first n elements | O(n) | O(1) |
|
|
467
|
+
| `skip(n: bigint): Semantic<E>` | Skips first n elements (bigint) | O(n) | O(1) |
|
|
468
|
+
| `sub(start: bigint, end: bigint): Semantic<E>` | Returns sub-semantic range | O(n) | O(1) |
|
|
469
|
+
| `takeWhile(predicate: Predicate<E>): Semantic<E>` | Takes elements while predicate is true | O(n) | O(1) |
|
|
470
|
+
| `takeWhile(predicate: BiPredicate<E, bigint>): Semantic<E>` | Takes elements while predicate is true with index | O(n) | O(1) |
|
|
471
|
+
| `translate(offset: number): Semantic<E>` | Translates element indices by offset | O(n) | O(1) |
|
|
472
|
+
| `translate(offset: bigint): Semantic<E>` | Translates element indices by offset (bigint) | O(n) | O(1) |
|
|
473
|
+
| `translate(translator: BiFunctional<E, bigint, bigint>): Semantic<E>` | Translates element indices with translator | O(n) | O(1) |
|
|
433
474
|
|
|
434
475
|
```typescript
|
|
435
476
|
// Semantic operation examples
|
|
@@ -456,15 +497,15 @@ let complexResult = range(1, 100, 1)
|
|
|
456
497
|
|
|
457
498
|
| Method | Description | Time Complexity | Space Complexity |
|
|
458
499
|
|------------|------------|------------|------------|
|
|
459
|
-
| `sorted()
|
|
460
|
-
| `sorted(comparator)
|
|
461
|
-
| `
|
|
462
|
-
| `
|
|
463
|
-
| `
|
|
464
|
-
| `
|
|
465
|
-
| `
|
|
466
|
-
| `
|
|
467
|
-
| `
|
|
500
|
+
| `sorted(): OrderedCollectable<E>` | Returns sorted collectable | O(n log n) | O(n) |
|
|
501
|
+
| `sorted(comparator: Comparator<E>): OrderedCollectable<E>` | Returns sorted collectable with comparator | O(n log n) | O(n) |
|
|
502
|
+
| `toCollectable(): Collectable<E>` | Converts to collectable | O(1) | O(1) |
|
|
503
|
+
| `toCollectable<C extends Collectable<E>>(mapper: Functional<Generator<E>, C>): C` | Converts to collectable with mapper | O(1) | O(1) |
|
|
504
|
+
| `toBigintStatistics(): BigIntStatistics<E>` | Converts to bigint statistics | O(1) | O(1) |
|
|
505
|
+
| `toNumericStatistics(): NumericStatistics<E>` | Converts to numeric statistics | O(1) | O(1) |
|
|
506
|
+
| `toOrdered(): OrderedCollectable<E>` | Converts to ordered collectable | O(1) | O(1) |
|
|
507
|
+
| `toUnordered(): UnorderedCollectable<E>` | Converts to unordered collectable | O(1) | O(1) |
|
|
508
|
+
| `toWindow(): WindowCollectable<E>` | Converts to window collectable | O(1) | O(1) |
|
|
468
509
|
|
|
469
510
|
```typescript
|
|
470
511
|
// Convert to an ascending sorted array
|
|
@@ -517,47 +558,63 @@ let customizedCollector = from([1, 2, 3, 4, 5]).toCollectable((generator: Genera
|
|
|
517
558
|
## Collectable Collection Methods
|
|
518
559
|
|
|
519
560
|
| Method | Description | Time Complexity | Space Complexity |
|
|
520
|
-
|
|
521
|
-
| `anyMatch(predicate)` |
|
|
522
|
-
| `allMatch(predicate)` |
|
|
523
|
-
| `collect(collector)` |
|
|
524
|
-
| `collect(identity
|
|
525
|
-
| `collect(identity,
|
|
526
|
-
| `
|
|
527
|
-
| `
|
|
528
|
-
| `
|
|
529
|
-
| `
|
|
530
|
-
| `
|
|
531
|
-
| `
|
|
532
|
-
| `
|
|
533
|
-
| `
|
|
534
|
-
| `
|
|
535
|
-
| `
|
|
536
|
-
| `
|
|
537
|
-
| `
|
|
538
|
-
| `
|
|
539
|
-
| `
|
|
540
|
-
| `
|
|
541
|
-
| `
|
|
542
|
-
| `
|
|
543
|
-
| `
|
|
544
|
-
| `
|
|
545
|
-
| `
|
|
546
|
-
| `
|
|
547
|
-
| `
|
|
548
|
-
| `
|
|
549
|
-
| `
|
|
550
|
-
| `
|
|
551
|
-
| `
|
|
552
|
-
| `
|
|
553
|
-
| `
|
|
554
|
-
| `
|
|
555
|
-
| `
|
|
556
|
-
| `
|
|
557
|
-
| `
|
|
558
|
-
| `
|
|
559
|
-
| `
|
|
560
|
-
| `
|
|
561
|
+
|--------|-------------|-----------------|------------------|
|
|
562
|
+
| `anyMatch(predicate: Predicate<E>): boolean` | Returns true if any element matches the predicate | O(n) | O(1) |
|
|
563
|
+
| `allMatch(predicate: Predicate<E>): boolean` | Returns true if all elements match the predicate | O(n) | O(1) |
|
|
564
|
+
| `collect<A, R>(collector: Collector<E, A, R>): R` | Collects elements using a collector | O(n) | O(1) |
|
|
565
|
+
| `collect<A, R>(identity: Supplier<A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): R` | Collects elements with accumulator and finisher | O(n) | O(1) |
|
|
566
|
+
| `collect<A, R>(identity: Supplier<A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): R` | Collects elements with index-aware accumulator | O(n) | O(1) |
|
|
567
|
+
| `collect<A, R>(identity: Supplier<A>, interruptor: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): R` | Collects with interruptor and accumulator | O(n) | O(1) |
|
|
568
|
+
| `collect<A, R>(identity: Supplier<A>, interruptor: BiPredicate<E, bigint>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): R` | Collects with index-aware interruptor | O(n) | O(1) |
|
|
569
|
+
| `collect<A, R>(identity: Supplier<A>, interruptor: TriPredicate<E, bigint, A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): R` | Collects with state-aware interruptor | O(n) | O(1) |
|
|
570
|
+
| `collect<A, R>(identity: Supplier<A>, interruptor: Predicate<E>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): R` | Collects with index-aware accumulator | O(n) | O(1) |
|
|
571
|
+
| `collect<A, R>(identity: Supplier<A>, interruptor: BiPredicate<E, bigint>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): R` | Collects with both index-aware | O(n) | O(1) |
|
|
572
|
+
| `collect<A, R>(identity: Supplier<A>, interruptor: TriPredicate<E, bigint, A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): R` | Collects with state and index awareness | O(n) | O(1) |
|
|
573
|
+
| `count(): bigint` | Counts number of elements | O(n) | O(1) |
|
|
574
|
+
| `error(): void` | Logs elements to console.error | O(n) | O(1) |
|
|
575
|
+
| `error(accumulator: BiFunctional<string, E, string>): void` | Logs with custom accumulator | O(n) | O(1) |
|
|
576
|
+
| `error(accumulator: TriFunctional<string, E, bigint, string>): void` | Logs with index-aware accumulator | O(n) | O(1) |
|
|
577
|
+
| `error(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): void` | Logs with prefix and suffix | O(n) | O(1) |
|
|
578
|
+
| `error(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): void` | Logs with index-aware accumulator | O(n) | O(1) |
|
|
579
|
+
| `isEmpty(): boolean` | Returns true if no elements | O(1) | O(1) |
|
|
580
|
+
| `findAny(): Optional<E>` | Returns any element randomly | O(1) | O(1) |
|
|
581
|
+
| `findFirst(): Optional<E>` | Returns the first element | O(1) | O(1) |
|
|
582
|
+
| `findLast(): Optional<E>` | Returns the last element | O(n) | O(1) |
|
|
583
|
+
| `findMaximum(): Optional<E>` | Returns maximum element | O(n) | O(1) |
|
|
584
|
+
| `findMaximum(comparator: Comparator<E>): Optional<E>` | Returns maximum with comparator | O(n) | O(1) |
|
|
585
|
+
| `findMinimum(): Optional<E>` | Returns minimum element | O(n) | O(1) |
|
|
586
|
+
| `findMinimum(comparator: Comparator<E>): Optional<E>` | Returns minimum with comparator | O(n) | O(1) |
|
|
587
|
+
| `forEach(action: Consumer<E>): void` | Performs action on each element | O(n) | O(1) |
|
|
588
|
+
| `forEach(action: BiConsumer<E, bigint>): void` | Performs action with index | O(n) | O(1) |
|
|
589
|
+
| `group<K>(classifier: Functional<E, K>): Map<K, Array<E>>` | Groups elements by classifier | O(n) | O(n) |
|
|
590
|
+
| `groupBy<K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Map<K, Array<V>>` | Groups with key-value mapping | O(n) | O(n) |
|
|
591
|
+
| `join(): string` | Joins elements into string | O(n) | O(1) |
|
|
592
|
+
| `join(delimiter: string): string` | Joins with delimiter | O(n) | O(1) |
|
|
593
|
+
| `join(prefix: string, delimiter: string, suffix: string): string` | Joins with prefix and suffix | O(n) | O(1) |
|
|
594
|
+
| `join(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): string` | Joins with custom accumulator | O(n) | O(1) |
|
|
595
|
+
| `join(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): string` | Joins with index-aware accumulator | O(n) | O(1) |
|
|
596
|
+
| `log(): void` | Logs elements to console.log | O(n) | O(1) |
|
|
597
|
+
| `log(accumulator: BiFunctional<string, E, string>): void` | Logs with custom accumulator | O(n) | O(1) |
|
|
598
|
+
| `log(accumulator: TriFunctional<string, E, bigint, string>): void` | Logs with index-aware accumulator | O(n) | O(1) |
|
|
599
|
+
| `log(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): void` | Logs with prefix and suffix | O(n) | O(1) |
|
|
600
|
+
| `log(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): void` | Logs with index-aware accumulator | O(n) | O(1) |
|
|
601
|
+
| `nonMatch(predicate: Predicate<E>): boolean` | Returns true if no element matches | O(n) | O(1) |
|
|
602
|
+
| `partition(count: bigint): Array<Array<E>>` | Partitions into groups of size | O(n) | O(n) |
|
|
603
|
+
| `partitionBy(classifier: Functional<E, bigint>): Array<Array<E>>` | Partitions by classifier | O(n) | O(n) |
|
|
604
|
+
| `reduce(accumulator: BiFunctional<E, E, E>): Optional<E>` | Reduces elements | O(n) | O(1) |
|
|
605
|
+
| `reduce(accumulator: TriFunctional<E, E, bigint, E>): Optional<E>` | Reduces with index | O(n) | O(1) |
|
|
606
|
+
| `reduce(identity: E, accumulator: BiFunctional<E, E, E>): E` | Reduces with identity | O(n) | O(1) |
|
|
607
|
+
| `reduce(identity: E, accumulator: TriFunctional<E, E, bigint, E>): E` | Reduces with identity and index | O(n) | O(1) |
|
|
608
|
+
| `reduce<R>(identity: R, accumulator: BiFunctional<R, E, R>, finisher: Functional<R, R>): R` | Reduces with finisher | O(n) | O(1) |
|
|
609
|
+
| `reduce<R>(identity: R, accumulator: TriFunctional<R, E, bigint, R>, finisher: Functional<R, R>): R` | Reduces with index and finisher | O(n) | O(1) |
|
|
610
|
+
| `semantic(): Semantic<E>` | Converts to semantic | O(1) | O(1) |
|
|
611
|
+
| `source(): Generator<E>` | Returns generator source | O(1) | O(1) |
|
|
612
|
+
| `toArray(): Array<E>` | Converts to array | O(n) | O(n) |
|
|
613
|
+
| `toMap<K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Map<K, V>` | Converts to map | O(n) | O(n) |
|
|
614
|
+
| `toSet(): Set<E>` | Converts to set | O(n) | O(n) |
|
|
615
|
+
| `write<S = string>(stream: WritableStream<S>): Promise<WritableStream<S>>` | Writes to stream | O(n) | O(1) |
|
|
616
|
+
| `write<S = string>(stream: WritableStream<S>, accumulator: BiFunctional<WritableStream<S>, E, WritableStream<S>>): Promise<WritableStream<S>>` | Writes with accumulator | O(n) | O(1) |
|
|
617
|
+
| `write<S = string>(stream: WritableStream<S>, accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>): Promise<WritableStream<S>>` | Writes with index-aware accumulator | O(n) | O(1) |
|
|
561
618
|
|
|
562
619
|
```typescript
|
|
563
620
|
// Collectable operation examples
|
|
@@ -590,58 +647,95 @@ data.join(", "); // "[2, 4, 6, 8, 10]"
|
|
|
590
647
|
## Unordered Collectable Methods
|
|
591
648
|
|
|
592
649
|
| Method | Description | Time Complexity | Space Complexity |
|
|
593
|
-
|
|
594
|
-
|
|
|
595
|
-
|
|
|
650
|
+
|--------|-------------|-----------------|------------------|
|
|
651
|
+
| `constructor(generator: Generator<E>)` | Creates unordered collectable | O(1) | O(1) |
|
|
652
|
+
| `source(): Generator<E>` | Returns generator source | O(1) | O(1) |
|
|
653
|
+
| `[Symbol.iterator](): Generator<E, void, undefined>` | Returns iterator | O(n) | O(1) |
|
|
654
|
+
| `[Symbol.asyncIterator](): AsyncGenerator<E, void, undefined>` | Returns async iterator | O(n) | O(1) |
|
|
596
655
|
|
|
597
656
|
## Ordered Collectable Methods
|
|
598
657
|
|
|
599
658
|
| Method | Description | Time Complexity | Space Complexity |
|
|
600
|
-
|
|
601
|
-
|
|
|
602
|
-
|
|
|
659
|
+
|--------|-------------|-----------------|------------------|
|
|
660
|
+
| `constructor(generator: Generator<E>)` | Creates ordered collectable | O(n log n) | O(n) |
|
|
661
|
+
| `constructor(generator: Generator<E>, comparator: Comparator<E>)` | Creates ordered collectable with comparator | O(n log n) | O(n) |
|
|
662
|
+
| `[Symbol.iterator](): Generator<E, void, undefined>` | Returns iterator | O(n) | O(1) |
|
|
663
|
+
| `[Symbol.asyncIterator](): AsyncGenerator<E, void, undefined>` | Returns async iterator | O(n) | O(1) |
|
|
664
|
+
| `source(): Generator<E>` | Returns indexed generator source | O(1) | O(1) |
|
|
665
|
+
| `isEmpty(): boolean` | Returns true if buffer is empty | O(1) | O(1) |
|
|
603
666
|
|
|
604
667
|
## Statistical Analysis Methods
|
|
605
668
|
|
|
606
669
|
### Statisttics Methods
|
|
607
670
|
|
|
608
671
|
| Method | Description | Time Complexity | Space Complexity |
|
|
609
|
-
|
|
610
|
-
|
|
|
611
|
-
|
|
|
612
|
-
| `
|
|
613
|
-
| `
|
|
672
|
+
|--------|-------------|-----------------|------------------|
|
|
673
|
+
| `constructor(generator: Generator<E>)` | Creates a statistics instance | O(n log n) | O(n) |
|
|
674
|
+
| `constructor(generator: Generator<E>, comparator: Comparator<E>)` | Creates a statistics instance with comparator | O(n log n) | O(n) |
|
|
675
|
+
| `[Symbol.iterator](): Generator<E, void, undefined>` | Returns iterator | O(n) | O(1) |
|
|
676
|
+
| `[Symbol.asyncIterator](): AsyncGenerator<E, void, undefined>` | Returns async iterator | O(n) | O(1) |
|
|
677
|
+
| `count(): bigint` | Returns the number of elements | O(1) | O(1) |
|
|
678
|
+
| `average(): D` | Returns the average (arithmetic mean) | O(n) | O(1) |
|
|
679
|
+
| `average(mapper: Functional<E, D>): D` | Returns the average of mapped values | O(n) | O(1) |
|
|
680
|
+
| `range(): D` | Returns the range (max-min) | O(1) | O(1) |
|
|
681
|
+
| `range(mapper: Functional<E, D>): D` | Returns the range of mapped values | O(1) | O(1) |
|
|
682
|
+
| `variance(): D` | Returns the variance | O(n) | O(1) |
|
|
683
|
+
| `variance(mapper: Functional<E, D>): D` | Returns the variance of mapped values | O(n) | O(1) |
|
|
684
|
+
| `standardDeviation(): D` | Returns the standard deviation | O(n) | O(1) |
|
|
685
|
+
| `standardDeviation(mapper: Functional<E, D>): D` | Returns the standard deviation of mapped values | O(n) | O(1) |
|
|
686
|
+
| `mean(): D` | Returns the mean (same as average) | O(n) | O(1) |
|
|
687
|
+
| `mean(mapper: Functional<E, D>): D` | Returns the mean of mapped values | O(n) | O(1) |
|
|
688
|
+
| `median(): D` | Returns the median | O(n) | O(n) |
|
|
689
|
+
| `median(mapper: Functional<E, D>): D` | Returns the median of mapped values | O(n) | O(n) |
|
|
690
|
+
| `mode(): D` | Returns the mode | O(n) | O(n) |
|
|
691
|
+
| `mode(mapper: Functional<E, D>): D` | Returns the mode of mapped values | O(n) | O(n) |
|
|
692
|
+
| `frequency(): Map<E, bigint>` | Returns the frequency distribution | O(n) | O(n) |
|
|
693
|
+
| `summate(): D` | Returns the sum of elements | O(n) | O(1) |
|
|
694
|
+
| `summate(mapper: Functional<E, D>): D` | Returns the sum of mapped values | O(n) | O(1) |
|
|
695
|
+
| `quantile(quantile: number): D` | Returns the specified quantile | O(1) | O(1) |
|
|
696
|
+
| `quantile(quantile: number, mapper: Functional<E, D>): D` | Returns the quantile of mapped values | O(1) | O(1) |
|
|
697
|
+
| `interquartileRange(): D` | Returns the interquartile range (IQR) | O(1) | O(1) |
|
|
698
|
+
| `interquartileRange(mapper: Functional<E, D>): D` | Returns the IQR of mapped values | O(1) | O(1) |
|
|
699
|
+
| `skewness(): D` | Returns the skewness measure | O(n) | O(1) |
|
|
700
|
+
| `skewness(mapper: Functional<E, D>): D` | Returns the skewness of mapped values | O(n) | O(1) |
|
|
701
|
+
| `kurtosis(): D` | Returns the kurtosis measure | O(n) | O(1) |
|
|
702
|
+
| `kurtosis(mapper: Functional<E, D>): D` | Returns the kurtosis of mapped values | O(n) | O(1) |
|
|
703
|
+
|
|
614
704
|
|
|
615
705
|
### NumericStatistics Methods
|
|
616
706
|
|
|
617
707
|
| Method | Description | Time Complexity | Space Complexity |
|
|
618
|
-
|
|
619
|
-
|
|
|
620
|
-
|
|
|
621
|
-
| `
|
|
622
|
-
| `
|
|
623
|
-
| `
|
|
624
|
-
| `
|
|
625
|
-
| `
|
|
626
|
-
| `
|
|
627
|
-
| `
|
|
628
|
-
| `
|
|
629
|
-
| `
|
|
630
|
-
| `
|
|
631
|
-
| `
|
|
632
|
-
| `
|
|
633
|
-
| `
|
|
634
|
-
| `
|
|
635
|
-
| `
|
|
636
|
-
| `
|
|
637
|
-
| `
|
|
638
|
-
| `
|
|
639
|
-
| `
|
|
640
|
-
| `
|
|
641
|
-
| `
|
|
642
|
-
| `
|
|
643
|
-
| `
|
|
644
|
-
| `
|
|
708
|
+
|--------|-------------|-----------------|------------------|
|
|
709
|
+
| `constructor(generator: Generator<E>)` | Creates a numeric statistics instance | O(n log n) | O(n) |
|
|
710
|
+
| `constructor(generator: Generator<E>, comparator: Comparator<E>)` | Creates a numeric statistics instance with comparator | O(n log n) | O(n) |
|
|
711
|
+
| `[Symbol.iterator](): Generator<E, void, undefined>` | Returns iterator | O(n) | O(1) |
|
|
712
|
+
| `[Symbol.asyncIterator](): AsyncGenerator<E, void, undefined>` | Returns async iterator | O(n) | O(1) |
|
|
713
|
+
| `count(): bigint` | Returns the number of elements | O(1) | O(1) |
|
|
714
|
+
| `average(): number` | Returns the numeric average | O(n) | O(1) |
|
|
715
|
+
| `average(mapper: Functional<E, number>): number` | Returns the average of mapped numeric values | O(n) | O(1) |
|
|
716
|
+
| `range(): number` | Returns the numeric range | O(1) | O(1) |
|
|
717
|
+
| `range(mapper: Functional<E, number>): number` | Returns the range of mapped numeric values | O(1) | O(1) |
|
|
718
|
+
| `variance(): number` | Returns the numeric variance | O(n) | O(1) |
|
|
719
|
+
| `variance(mapper: Functional<E, number>): number` | Returns the variance of mapped numeric values | O(n) | O(1) |
|
|
720
|
+
| `standardDeviation(): number` | Returns the numeric standard deviation | O(n) | O(1) |
|
|
721
|
+
| `standardDeviation(mapper: Functional<E, number>): number` | Returns the standard deviation of mapped numeric values | O(n) | O(1) |
|
|
722
|
+
| `mean(): number` | Returns the numeric mean (same as average) | O(n) | O(1) |
|
|
723
|
+
| `mean(mapper: Functional<E, number>): number` | Returns the mean of mapped numeric values | O(n) | O(1) |
|
|
724
|
+
| `median(): number` | Returns the numeric median | O(n) | O(n) |
|
|
725
|
+
| `median(mapper: Functional<E, number>): number` | Returns the median of mapped numeric values | O(n) | O(n) |
|
|
726
|
+
| `mode(): number` | Returns the numeric mode | O(n) | O(n) |
|
|
727
|
+
| `mode(mapper: Functional<E, number>): number` | Returns the mode of mapped numeric values | O(n) | O(n) |
|
|
728
|
+
| `frequency(): Map<E, bigint>` | Returns the frequency distribution | O(n) | O(n) |
|
|
729
|
+
| `summate(): number` | Returns the numeric sum | O(n) | O(1) |
|
|
730
|
+
| `summate(mapper: Functional<E, number>): number` | Returns the sum of mapped numeric values | O(n) | O(1) |
|
|
731
|
+
| `quantile(quantile: number): number` | Returns the specified numeric quantile | O(1) | O(1) |
|
|
732
|
+
| `quantile(quantile: number, mapper: Functional<E, number>): number` | Returns the quantile of mapped numeric values | O(1) | O(1) |
|
|
733
|
+
| `interquartileRange(): number` | Returns the numeric interquartile range | O(1) | O(1) |
|
|
734
|
+
| `interquartileRange(mapper: Functional<E, number>): number` | Returns the IQR of mapped numeric values | O(1) | O(1) |
|
|
735
|
+
| `skewness(): number` | Returns the numeric skewness | O(n) | O(1) |
|
|
736
|
+
| `skewness(mapper: Functional<E, number>): number` | Returns the skewness of mapped numeric values | O(n) | O(1) |
|
|
737
|
+
| `kurtosis(): number` | Returns the numeric kurtosis | O(n) | O(1) |
|
|
738
|
+
| `kurtosis(mapper: Functional<E, number>): number` | Returns the kurtosis of mapped numeric values | O(n) | O(1) |
|
|
645
739
|
|
|
646
740
|
```typescript
|
|
647
741
|
// Statistical analysis examples
|
|
@@ -666,43 +760,49 @@ console.log("Mapped mean:", objects.mean(obj => obj.value)); // 20
|
|
|
666
760
|
### BigintStatistics Methods
|
|
667
761
|
|
|
668
762
|
| Method | Description | Time Complexity | Space Complexity |
|
|
669
|
-
|
|
670
|
-
|
|
|
671
|
-
|
|
|
672
|
-
| `
|
|
673
|
-
| `
|
|
674
|
-
| `
|
|
675
|
-
| `
|
|
676
|
-
| `
|
|
677
|
-
| `
|
|
678
|
-
| `
|
|
679
|
-
| `
|
|
680
|
-
| `
|
|
681
|
-
| `
|
|
682
|
-
| `
|
|
683
|
-
| `
|
|
684
|
-
| `
|
|
685
|
-
| `
|
|
686
|
-
| `
|
|
687
|
-
| `
|
|
688
|
-
| `
|
|
689
|
-
| `
|
|
690
|
-
| `
|
|
691
|
-
| `
|
|
692
|
-
| `
|
|
693
|
-
| `
|
|
694
|
-
| `
|
|
695
|
-
| `
|
|
763
|
+
|--------|-------------|-----------------|------------------|
|
|
764
|
+
| `constructor(generator: Generator<E>)` | Creates a bigint statistics instance | O(n log n) | O(n) |
|
|
765
|
+
| `constructor(generator: Generator<E>, comparator: Comparator<E>)` | Creates a bigint statistics instance with comparator | O(n log n) | O(n) |
|
|
766
|
+
| `[Symbol.iterator](): Generator<E, void, undefined>` | Returns iterator | O(n) | O(1) |
|
|
767
|
+
| `[Symbol.asyncIterator](): AsyncGenerator<E, void, undefined>` | Returns async iterator | O(n) | O(1) |
|
|
768
|
+
| `count(): bigint` | Returns the number of elements | O(1) | O(1) |
|
|
769
|
+
| `average(): bigint` | Returns the bigint average | O(n) | O(1) |
|
|
770
|
+
| `average(mapper: Functional<E, bigint>): bigint` | Returns the average of mapped bigint values | O(n) | O(1) |
|
|
771
|
+
| `range(): bigint` | Returns the bigint range | O(1) | O(1) |
|
|
772
|
+
| `range(mapper: Functional<E, bigint>): bigint` | Returns the range of mapped bigint values | O(1) | O(1) |
|
|
773
|
+
| `variance(): bigint` | Returns the bigint variance | O(n) | O(1) |
|
|
774
|
+
| `variance(mapper: Functional<E, bigint>): bigint` | Returns the variance of mapped bigint values | O(n) | O(1) |
|
|
775
|
+
| `standardDeviation(): bigint` | Returns the bigint standard deviation | O(n) | O(1) |
|
|
776
|
+
| `standardDeviation(mapper: Functional<E, bigint>): bigint` | Returns the standard deviation of mapped bigint values | O(n) | O(1) |
|
|
777
|
+
| `mean(): bigint` | Returns the bigint mean (same as average) | O(n) | O(1) |
|
|
778
|
+
| `mean(mapper: Functional<E, bigint>): bigint` | Returns the mean of mapped bigint values | O(n) | O(1) |
|
|
779
|
+
| `median(): bigint` | Returns the bigint median | O(n) | O(n) |
|
|
780
|
+
| `median(mapper: Functional<E, bigint>): bigint` | Returns the median of mapped bigint values | O(n) | O(n) |
|
|
781
|
+
| `mode(): bigint` | Returns the bigint mode | O(n) | O(n) |
|
|
782
|
+
| `mode(mapper: Functional<E, bigint>): bigint` | Returns the mode of mapped bigint values | O(n) | O(n) |
|
|
783
|
+
| `frequency(): Map<E, bigint>` | Returns the frequency distribution | O(n) | O(n) |
|
|
784
|
+
| `summate(): bigint` | Returns the bigint sum | O(n) | O(1) |
|
|
785
|
+
| `summate(mapper: Functional<E, bigint>): bigint` | Returns the sum of mapped bigint values | O(n) | O(1) |
|
|
786
|
+
| `quantile(quantile: number): bigint` | Returns the specified bigint quantile | O(1) | O(1) |
|
|
787
|
+
| `quantile(quantile: number, mapper: Functional<E, bigint>): bigint` | Returns the quantile of mapped bigint values | O(1) | O(1) |
|
|
788
|
+
| `interquartileRange(): bigint` | Returns the bigint interquartile range | O(1) | O(1) |
|
|
789
|
+
| `interquartileRange(mapper: Functional<E, bigint>): bigint` | Returns the IQR of mapped bigint values | O(1) | O(1) |
|
|
790
|
+
| `skewness(): bigint` | Returns the bigint skewness | O(n) | O(1) |
|
|
791
|
+
| `skewness(mapper: Functional<E, bigint>): bigint` | Returns the skewness of mapped bigint values | O(n) | O(1) |
|
|
792
|
+
| `kurtosis(): bigint` | Returns the bigint kurtosis | O(n) | O(1) |
|
|
793
|
+
| `kurtosis(mapper: Functional<E, bigint>): bigint` | Returns the kurtosis of mapped bigint values | O(n) | O(1) |
|
|
696
794
|
|
|
697
795
|
### Window Collectable Methods
|
|
698
796
|
|
|
699
797
|
| Method | Description | Time Complexity | Space Complexity |
|
|
700
|
-
|
|
701
|
-
|
|
|
702
|
-
|
|
|
703
|
-
| `
|
|
704
|
-
| `
|
|
705
|
-
| `
|
|
798
|
+
|--------|-------------|-----------------|------------------|
|
|
799
|
+
| `constructor(generator: Generator<E>)` | Creates a window collectable instance | O(n log n) | O(n) |
|
|
800
|
+
| `constructor(generator: Generator<E>, comparator: Comparator<E>)` | Creates a window collectable with comparator | O(n log n) | O(n) |
|
|
801
|
+
| `[Symbol.iterator](): Generator<E, void, undefined>` | Returns iterator | O(n) | O(1) |
|
|
802
|
+
| `[Symbol.asyncIterator](): AsyncGenerator<E, void, undefined>` | Returns async iterator | O(n) | O(1) |
|
|
803
|
+
| `slide(size: bigint): Semantic<Semantic<E>>` | Creates sliding windows of elements with 1 step | O(m × n) | O(m × n) |
|
|
804
|
+
| `slide(size: bigint, step: bigint): Semantic<Semantic<E>>` | Creates sliding windows of elements | O(m × n) | O(m × n) |
|
|
805
|
+
| `tumble(size: bigint): Semantic<Semantic<E>>` | Creates tumbling windows of elements | O(k × n) | O(k × n) |
|
|
706
806
|
|
|
707
807
|
## Performance Selection Guide
|
|
708
808
|
|
|
@@ -749,7 +849,6 @@ let bigIntStatistics: BigintStatistics<bigint> = data
|
|
|
749
849
|
3. **Memory Usage**: Sorting operations require O(n) additional space
|
|
750
850
|
4. **Real-time Data**: Semantic streams are suitable for processing real-time data and support asynchronous data sources
|
|
751
851
|
|
|
752
|
-
|
|
753
852
|
This library provides TypeScript developers with powerful and flexible streaming capabilities, combining the benefits of functional programming with type safety guarantees.
|
|
754
853
|
|
|
755
854
|
|