A persistent and immutable Java collections library offering efficient, thread-safe alternatives to the Java Collections Framework.
PCollections is a Java library that provides persistent and immutable versions of common collection types like sets, maps, vectors, and stacks. It solves the problem of inefficient copying in immutable collections by offering efficient producers (e.g., `plus()` and `minus()`) that create new collections with minimal overhead, making immutable data structures practical for performance-sensitive applications.
Java developers building concurrent, functional, or immutable-style applications who need thread-safe collections with efficient modification operations, especially those working in domains like parallel processing, data transformation, or systems requiring high reliability.
Developers choose PCollections over alternatives like Guava's immutable collections or Java's unmodifiable wrappers because it offers true persistence—efficient producers that avoid full collection copies—while maintaining full compatibility with the Java Collections Framework, ensuring easy integration into existing codebases.
A Persistent Java Collections Library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Methods like `plus()` and `minus()` create new collections in sublinear time and space, avoiding full copies, as highlighted in the README's comparison with Java's unmodifiable collections.
Every PCollection implements standard Java Collection interfaces, enabling drop-in replacement and easy integration with existing code, as noted in the interoperability section.
Immutability guarantees safe concurrent access without synchronization, making it ideal for multithreaded applications without extra locking overhead.
Provides analogs for key Java collections like HashTreePMap (HashMap) and TreePVector (ArrayList), covering common use cases as detailed in the implementations list.
Focused on core persistent structures, it lacks specialized collections like concurrent mutable variants or streaming APIs that other libraries might offer.
Structures like TreePVector have logarithmic access times for random access, which can be slower than mutable ArrayList's constant time in performance-critical scenarios.
Developers accustomed to imperative, mutable collections must adapt to functional patterns, which can increase initial learning and refactoring effort.