CHAPTER 4 LISTS, MAPS, AND RANGES

In this chapter, we introduce the list, map, and range. All are collections of references to other objects. The List and Map can reference objects of differing types. The Range represents a collection of integer values. The List and Map also grow dynamically. Each object referenced in a List is identified by an integer index. In contrast, a Map collection is indexed by a value of any kind. Because the class of the objects maintained by these collections is arbitrary, the elements of a List might be a Map and the elements of a Map might be a List. In this way, we can create data structures of arbitrary complexity. This is examined in Chapter 6 and in subsequent chapters.

4.1 LISTS

The List is a structure used ...

Get Groovy Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.