Top Description Interfaces Classes
module org.pcollections

Package org.pcollections


A persistent and immutable analogue of the Java Collections API.

All of the provided implementations are thread-safe (although their iterators may not be) but this is not required by the interfaces.

The classes and interfaces in this package are related as follows. Note the importance of IntTreePMap, which provides the backing for every provided implementation except ConsPStack:

Interface Summary

Modifier and TypeInterface and Description
public interface
PBag<E>

An unordered collection allowing duplicate elements.

public interface
PCollection<E>

An immutable, persistent collection of elements of type E.

public interface
PMap<K, V>

An immutable, persistent map from keys of type K to values of type V.

Some implementations may not support null keys and/or values, in which case they will throw NullPointerException for attempts to add such keys/values.

public interface
PQueue<E>

A persistent queue.

public interface
PSequence<E>

An immutable, persistent indexed collection.

public interface
PSet<E>

An immutable, persistent set, containing no duplicate elements.

public interface
PSortedMap<
the type of keys maintained by this map
K
,
the type of mapped values
V
>

An immutable, persistent map from keys of type K to values of type V, with keys arranged in sorted order (according to some java.util.Comparator), and with various methods to obtain specific mappings or ranges of mappings based on this ordering (such as the least key greater than some instance of type K, or the sub-map with keys between two instances of type K).

public interface
PSortedSet<
the type of elements maintained by this set
E
>

An immutable, persistent set of distinct elements, with elements arranged in sorted order (according to some java.util.Comparator), and with various methods to obtain specific elements or ranges of elements based on this ordering (such as the least element greater than some value, or the set of elements between two values).

public interface
PStack<E>

An immutable, persistent stack.

public interface
PVector<E>

An immutable, persistent list.

Class Summary

Modifier and TypeClass and Description
public abstract class
AbstractUnmodifiableCollection<E>

A subclass of AbstractCollection that overrides the various mutator methods to mark them as deprecated and unconditionally throw UnsupportedOperationException.

public abstract class
AbstractUnmodifiableList<E>

A subclass of AbstractList that overrides the various mutator methods to mark them as deprecated and unconditionally throw UnsupportedOperationException.

public abstract class
AbstractUnmodifiableMap<
the type of keys maintained by this map
K
,
the type of mapped values
V
>

A subclass of AbstractMap that overrides the various mutator methods to mark them as deprecated and unconditionally throw UnsupportedOperationException.

public abstract class
AbstractUnmodifiableQueue<E>

A subclass of AbstractQueue that overrides the various mutator methods to mark them as deprecated and unconditionally throw UnsupportedOperationException.

public abstract class
AbstractUnmodifiableSequentialList<E>

A subclass of AbstractSequentialList that overrides the various mutator methods to mark them as deprecated and unconditionally throw UnsupportedOperationException.

public abstract class
AbstractUnmodifiableSet<
the type of elements maintained by this set
E
>

A subclass of AbstractSet that overrides the various mutator methods to mark them as deprecated and unconditionally throw UnsupportedOperationException.

public class
public class
ConsPStack<E>

A simple persistent stack.

public class
Empty

A static utility class for getting empty PCollections backed by the 'default' implementations.

public class
HashPMap<K, V>

A persistent map from keys to values.

public class
HashTreePBag

A static convenience class for creating efficient persistent bags.

public class
HashTreePMap

A static convenience class for creating efficient persistent maps.

public class
HashTreePSet

A static convenience class for creating efficient persistent sets.

pack-priv class
IntTree<V>

A non-public utility class for persistent balanced tree maps with integer keys.

public class
IntTreePMap<V>

An efficient persistent map from integer keys to values.

pack-priv class
KVTree<
the key type; serves as the key type for TreePMap, and as the element type for TreePSet. This class provides various methods that maintain the ordering and distinctness of keys based on a client-provided instance of Comparator<? super K>.
K
,
the value type; serves as the value type for TreePMap. (Is ignored by TreePSet.)
V
>

A persistent (immutable, purely functional) balanced-binary-tree implementation, with such functionality as is needed to support implementations of PSortedMap and PSortedSet, namely TreePMap and TreePSet.

public class
MapPBag<E>

A map-backed persistent bag.

public class
MapPSet<E>

A map-backed persistent set.

public class
OrderedPMap<K, V>

Like PMap but preserves insertion order.

public class
OrderedPSet<E>

Like PSet but preserves insertion order.

public class
TreePMap<
the type of keys maintained by this map
K
,
the type of mapped values
V
>

An implementation of PSortedMap based on a self-balancing binary search tree.

public class
TreePSet<
the type of elements maintained by this set
E
>

An implementation of PSortedSet based on a self-balancing binary search tree.

public class
TreePVector<E>

A persistent vector of elements.