diff --git a/src/Iterators-Decorators/IteratorWithCollectionAPI.class.st b/src/Iterators-Decorators/IteratorWithCollectionAPI.class.st index a1c71c0..cd8e122 100644 --- a/src/Iterators-Decorators/IteratorWithCollectionAPI.class.st +++ b/src/Iterators-Decorators/IteratorWithCollectionAPI.class.st @@ -237,6 +237,14 @@ IteratorWithCollectionAPI >> isNotEmpty [ ^ self hasNext ] +{ #category : #accessing } +IteratorWithCollectionAPI >> iterator [ + "To be polymorphic with objects providing an iterator. + No need to decorate twice. + " + ^ self +] + { #category : #testing } IteratorWithCollectionAPI >> occurrencesOf: anObject [ "Answer how many of the receiver's elements are equal to anObject." diff --git a/src/Iterators/Iterator.class.st b/src/Iterators/Iterator.class.st index 5822805..943f929 100644 --- a/src/Iterators/Iterator.class.st +++ b/src/Iterators/Iterator.class.st @@ -17,6 +17,12 @@ Iterator >> atEnd [ ^ self hasNext not ] +{ #category : #accessing } +Iterator >> basicIterator [ + "To be polymorphic with objects providing a basicIterator." + ^ self +] + { #category : #private } Iterator >> checkHasNext [ self hasNext @@ -41,6 +47,12 @@ Iterator >> isDecorator [ ^ false ] +{ #category : #accessing } +Iterator >> iterator [ + "To be polymorphic with objects providing an iterator." + ^ self withCollectionAPI +] + { #category : #accessing } Iterator >> last [ ^ (self decoratedBy: [ :x :y | y ] foldIt) next