Iterator Pattern in TypeScript

The Iterator will commonly contain two methods that perform the following concepts.

  • next: returns the next object in the aggregate (collection, object).
  • hasNext: returns a Boolean indicating if the Iterable is at the end of the iteration or not.

The benefits of using the Iterator pattern are that the client can traverse a collection of aggregates(objects) without needing to understand their internal representations and/or data structures.





A Design Pattern is a description or template that can be repeatedly applied to a commonly recurring problem in software design. A familiarity of Design Patterns is very useful when planning, discussing, managing and documenting your applications from now on and into the future.

Recommended from Medium

Web Accessibility: Angular Web Component to toggle options between two Listbox(s)

Should I use CSS BEM with Angular? part I

the essential ‘REACT HOOKS’

How to Use Buttons in Vuetify

How abstraction helps you get the most out of UI components

Building A Basic Node Backend

Things to know before using react-navigation

Top 5 Most Popular JavaScript Questions on Stack Overflow

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sean Bradley

Sean Bradley

Developer of real time, low latency, high availability, asynchronous, multi threaded, remotely managed, fully automated and monitored solutions.

More from Medium

Strategy Pattern in TypeScript

Maintaining TypeScript Superpowers When Types Are Out of Reach

In-Depth Look at TypeScript Generics: Part 2 — Advanced Inference

5 NestJS Techniques to Build Efficient and Maintainable Apps