Chapter 3. Xyster_Collection

Table of Contents

3.1. Introduction
3.2. Collections
3.3. Lists
3.4. Sets
3.4.1. Sortable Sets and Comparators
3.5. Maps
3.5.1. String Maps
3.5.2. Object Maps
3.6. Xyster_Collection Static Methods

3.1. Introduction

PHP 5 brought us many useful features in the form of the SPL. We could now iterate over objects in a customizable way. Xyster's collections package is intended to utilize these features in a standard way and inherit good ideas from the collection packages of other popular platforms (read: Java and .NET).

Below is a list of the types of collections you will find in this package. You might have seen some of these terms before when working with other languages.

Collection

The base term for a traversable grouping of objects.

List

A list is just like a numeric array: objects are stored at numeric indexes.

Set

A collection that can contain only one entry for any unique object.

Map

A collection consisting of key-and-value pairs; the keys can be scalar types or objects.