restructure
This commit is contained in:
parent
ef7661245b
commit
598a10bc28
182 changed files with 342 additions and 336 deletions
|
@ -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>;
|
||||
}
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue