restructure

This commit is contained in:
JMARyA 2024-01-17 09:00:45 +01:00
parent ef7661245b
commit 598a10bc28
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
182 changed files with 342 additions and 336 deletions

View file

@ -0,0 +1,17 @@
---
obj: concept
---
# Iterator Pattern
## **Description:**
The Iterator Pattern is a behavioral design pattern that provides a way to access the elements of a collection sequentially without exposing its underlying representation. It defines a common interface for iterating over various types of collections, such as arrays, lists, trees, and more. The pattern separates the responsibility of iteration from the collection itself, promoting encapsulation and flexibility.
## **Example:**
[Rust](../../languages/Rust.md) has iterators which can be extended by functional programming methods like `map()`, etc.
```rust
trait Iterator<T> {
fn has_next(&self) -> bool;
fn next(&mut self) -> Option<T>;
}
```