Documentation
¶
Overview ¶
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
- func NewUnitIterator[T any](item T) *unitIterator[T]
- type Iterator
- func NewAppendIterator[T any](left Iterator[T], right Iterator[T]) Iterator[T]
- func NewArrayIterator[T any](items []T) Iterator[T]
- func NewCastIterator[S, T any](iter Iterator[S]) Iterator[T]
- func NewFlattenIterator[S, T any](iter Iterator[S], fn func(S) Iterator[T]) Iterator[T]
- func NewProjectIterator[S, T any](iter Iterator[S], projection func(S) T) Iterator[T]
- func NewReverseArrayIterator[T any](items []T) Iterator[T]
- type Predicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewUnitIterator ¶
func NewUnitIterator[T any](item T) *unitIterator[T]
NewUnitIterator construct an iterator over an array of items.
Types ¶
type Iterator ¶
type Iterator[T any] interface { enum.Enumerator[T] // Append another iterator onto the end of this iterator. Thus, when all // items are visited in this iterator, iteration continues into the other. Append(Iterator[T]) Iterator[T] // Clone creates a copy of this iterator at the given cursor position. // Modifying the clone (i.e. by calling Next) iterator will not modify the // original. Clone() Iterator[T] // Collect allocates a new array containing all items of this iterator. // This drains the iterator. Collect() []T // Find returns the index of the first match for a given predicate, or // return false if no match is found. This will mutate the iterator. Find(Predicate[T]) (uint, bool) // Count the number of items left. Note, this does not modify the iterator. Count() uint }
Iterator is an adapter which sits on top of a BaseIterator and provides various useful and reusable functions.
func NewAppendIterator ¶
NewAppendIterator construct an iterator over an array of items.
func NewArrayIterator ¶
NewArrayIterator construct an iterator over an array of items.
func NewCastIterator ¶
NewCastIterator construct an iterator over an array of items.
func NewFlattenIterator ¶
NewFlattenIterator adapts a sequence of items S which themselves can be iterated as items T, into a flat sequence of items T.
func NewProjectIterator ¶
NewProjectIterator construct an iterator that is the projection of another.
func NewReverseArrayIterator ¶
NewReverseArrayIterator constructs an iterator that yields the elements of items in reverse order, starting from the last element.