Joda-Primitives has been archived and is not under active development.
Joda-Primitives provides collections and utilities to bridge the gap between objects and primitive types in Java.
The standard Java collections API only operates on reference types, not primitives, like int. This project provides interfaces and implementations for primitives.
Joda-Primitives is licensed under the business-friendly Apache 2.0 licence.
Primitive implementations are provided for:
Why Joda Primitives?
Joda-Primitives provides collections based around storage in primitive array objects such as int. By contrast, the JDK collections store data as Objects, for example of type Integer.
When you add an int to a JDK collection, the compiler silently creates an box using Integer.valueOf(n). And when you retrieve the value, the compiler silently calls the .intValue() method. By avoiding this object creation, Joda-Primitives collections are much faster, use much less memory and create less garbage than equivalent boxed collections.
Interfaces and implementations are provided for each primitive type. The interface has additional dedicated methods relevant to the primitive type. See the Javadoc for more details.
This project is an offshoot of Commons Primitives. The two projects have very different designs. Commons Primitives defines interfaces independent of the JDK collection interfaces. Joda-Primitives defines interfaces that extend the JDK collection interfaces. This project offers deeper direct integration, however this results in certain method names being different from JDK collections.
Release 1.0 is the current latest release. This release is considered stable and worthy of the 1.x tag.
Joda-Primitives requires Java SE 5 or later and has no dependencies.
Available in Maven Central.
<dependency> <groupId>org.joda</groupId> <artifactId>joda-primitives</artifactId> <version>1.0</version> </dependency>