Statements (51)
Predicate | Object |
---|---|
gptkbp:instanceOf |
gptkb:programming_language
|
gptkbp:advantage |
enables polymorphic traversal
improves maintainability simplifies code |
gptkbp:allows |
sequential access
element modification element removal |
gptkbp:category |
gptkb:architecture
Design Pattern |
gptkbp:commonIn |
gptkb:Java
gptkb:JavaScript gptkb:Python gptkb:C++ |
gptkbp:compatibleWith |
random access
|
gptkbp:definedIn |
design patterns
iterator pattern |
gptkbp:example |
C++ STL iterator
Java Iterator interface JavaScript ES6 iterator protocol Python for loop for-each loop |
gptkbp:feature |
can be external or internal
can be forward or bidirectional can be mutable or immutable decouples collection from traversal encapsulates iteration logic supports lazy evaluation |
https://www.w3.org/2000/01/rdf-schema#label |
Iterator
|
gptkbp:interface |
C++ std::iterator
Java.util.Iterator JavaScript Symbol.iterator Python iterator protocol |
gptkbp:introducedIn |
Gang of Four design patterns book
|
gptkbp:method |
hasNext()
next() remove() __iter__() __next__() |
gptkbp:pattern |
behavioral pattern
|
gptkbp:purpose |
abstract traversal logic
access elements of a collection traverse a container |
gptkbp:relatedTo |
gptkb:Cursor
Generator Iterable Enumerator |
gptkbp:usedIn |
object-oriented programming
computer programming functional programming |
gptkbp:bfsParent |
gptkb:java.util_package
|
gptkbp:bfsLayer |
5
|