Download the PHP package techdivision/collections without Composer
On this page you can find all versions of the php package techdivision/collections. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download techdivision/collections
More information about techdivision/collections
Files in techdivision/collections
Package collections
Short Description Package that provides basic PHP collections and utilities.
License OSL-3.0
Homepage https://github.com/techdivision/TechDivision_Collections
Informations about the package collections
TechDivision_Collections
Introduction
This package provides a generic collection library.
The library is based on the SPL extension of PHP5 and uses the introduced iterators. The library also provides, beside the most used collection types, interfaces and exceptions.
Installation
If you want to use the library with your application you can install it by adding
to your and invoke in your project.
Usage
The following examples will give you a short introduction how you can use the classes provided by this library.
ArrayList
An ArrayList will provide a container that can store items of different data types. With the provided methods, elements can be added, returned oder deleted. The ArrayList is unsorted and has an ongoing integer index that starts with 0.
HashMap
A HashMap will provide a container that can store items of different data types. With the provided methods, elements can be added, returned oder deleted. The HashMap is unsorted like an ArrayList and all simple data types are supported as index.
Dictionary
A Dictionary, like an ArrayList or a HashMap, will provide a container that can store items of different data types. With the provided methods, elements can be added, returned oder deleted. The Dictionary is unsorted like an ArrayList. But in opposite to an ArrayList or a HashMap, between simple data types, also objects are allowed as index.
TreeMap
The usage of a TreeMap is very similar to a HashMap. The main difference is, that the items are either sorted ascending, or by the Predicate passed to the constructor.
The next example gives you an example implementation for using a TreeMap, sorted with a Comparator.
External Links
- Documentation at appserver.io
- Documentation on GitHub
- Getting started