+ All Categories
Home > Documents > What do the Java Collection Framework iterators provide ...se362/PatternOverviews/Iterator.pdf · 1...

What do the Java Collection Framework iterators provide ...se362/PatternOverviews/Iterator.pdf · 1...

Date post: 24-Jun-2020
Category:
Upload: others
View: 3 times
Download: 0 times
Share this document with a friend
1
1 1 What do the Java Collection Framework iterators provide for you? 2 The Iterator pattern provides controlled access to a collection without exposing internals. §Given An aggregate collection of objects §Desired Access all elements in the collection Do not expose internal structure Access is independent of the collection Multiple accesses can be done independent of each other Collection can be maintained independent of the access §Solution Iterator object controls access
Transcript
Page 1: What do the Java Collection Framework iterators provide ...se362/PatternOverviews/Iterator.pdf · 1 1 What do the Java Collection Framework iterators provide for you? 2 The Iterator

1

1

What do the Java Collection Framework iterators provide for you?

2

The Iterator pattern provides controlled access to a collection without exposing internals.

§Given• An aggregate collection of objects

§Desired• Access all elements in the collection• Do not expose internal structure• Access is independent of the collection• Multiple accesses can be done independent of

each other• Collection can be maintained independent of the

access

§Solution• Iterator object controls access

Recommended