Book Image

Mastering Gradle

Book Image

Mastering Gradle

Overview of this book

Table of Contents (17 chapters)
Mastering Gradle
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Collections


We assume you have basic knowledge on Java Collection Framework (JCF), so we are not going to discuss the fundamentals of the collection framework. We start on what Groovy provides on collection framework and frequently used utility methods provided by different collection objects.

Groovy supports different collective data types to store group of objects, such as range, lists, sets, and maps. If you are already a Java programmer, you will find how easy it is in Groovy to play with collective data types as compared to Java. Apart from sets, lists, and maps, Groovy has introduced ranges, which was not available in Java.

Set

A set is an unordered collection of objects, with no duplicates. It can be considered as an unordered list with restrictions on uniqueness, and is often constructed from a list. Set can also contain at most one null element. As implied by its name, this interface models the mathematical set abstraction.

The following code snippet explains how to create a Set. Elements...