MCPcopy
hub / github.com/Effect-TS/effect / BucketIterator

Class BucketIterator

packages/effect/src/MutableHashMap.ts:81–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81class BucketIterator<K, V> implements Iterator<[K, V]> {
82 constructor(readonly backing: Iterator<NonEmptyArray<readonly [K, V]>>) {}
83 currentBucket: Iterator<readonly [K, V]> | undefined
84 next(): IteratorResult<[K, V]> {
85 if (this.currentBucket === undefined) {
86 const result = this.backing.next()
87 if (result.done) {
88 return result
89 }
90 this.currentBucket = result.value[Symbol.iterator]()
91 }
92 const result = this.currentBucket.next()
93 if (result.done) {
94 this.currentBucket = undefined
95 return this.next()
96 }
97 return result as IteratorResult<[K, V]>
98 }
99}
100
101/**
102 * @since 2.0.0

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected