Module com.jongsoft.lang
Package com.jongsoft.lang.collection
A purely functional based set of collection implementations based upon the Collection.
The implementation consists out of the following groups of interfaces:
- Sequence, a ordered collection type
- Set, a collection type that ensures uniqueness
- Map, a map implementation
- Iterator, a custom iteration implementation
All implementations within this set of collections are immutable. Meaning that all operations on the collections will result into either a new instance or an unchanged one. This leads to implementations similar to the snippet to add values to a Collection.
// Correct usage of an immutable collection
Sequence<String> myStrings = API.List("one")
.add("two")
.add("three");
// Incorrect usage of an immutable collection, as the initial collection assigned to myString does not change
Sequence<String> myStrings = API.List("one");
myStrings.add("two");
myStrings.add("three");
- Since:
- 0.0.2
- Author:
- Gerben Jongerius
- See Also:
- Immutable objects explaind
-
Interface Summary Interface Description Collection<T> The collection interface enables basic operations that allow access to the elements.Foldable<T> In functional programming, fold (also termed reduce, accumulate, aggregate, compress, or inject) refers to a family of higher-order functions that analyze a recursive data structure and through use of a given combining operation, recombine the results of recursively processing its constituent parts, building up a return value.Iterator<T> An extension on the defaultIterator
that adds utility operations to easily manipulate the iterator or locate elements inside it.List<T> Map<K,T> This class represents a map implementation that is immutable.Pipeline<T> A pipeline is a set of commands that will be applied on top anyCollection
.Sequence<T> Sequences are ordered collections of elements.Set<T> The set is an extension of theCollection
interface that guarantees only unique elements are contained within the set.Traversable<T> Tree<T> Tree.NodeCollection<T> The node collection is a set of tree elements each containing exactly one value. -
Class Summary Class Description Collectors