Skip to Main Content
Mastering Delphi Programming: A Complete Reference Guide
book

Mastering Delphi Programming: A Complete Reference Guide

by Primož Gabrijelčič
November 2019
Beginner to intermediate content levelBeginner to intermediate
674 pages
15h
English
Packt Publishing
Content preview from Mastering Delphi Programming: A Complete Reference Guide

Iterator

An iterator pattern is used to traverse a container and access its elements. The power of this pattern is that it decouples algorithms from the container implementation. We can then write an algorithm that is coded to the iterator interface and not to the actual implementation of the container. 

Let's say we have two completely different data structures, an array and a linked list. If we need to implement the same algorithm operating on both structures, we have to write two versions of the code. You would access an array with direct addressing and the other would walk the linked list.

On the other hand, if both the array and linked list implement the same interface that allows the algorithm to walk over the data and access all elements, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Delphi GUI Programming with FireMonkey

Delphi GUI Programming with FireMonkey

Andrea Magni
Delphi Cookbook - Third Edition

Delphi Cookbook - Third Edition

Daniele Spinetti, Daniele Teti

Publisher Resources

ISBN: 9781838989118Other