
integers
About integers
integers
is a Java library that provides collections of integral primitive types (int
and long
, other types are also possible). Its API resembles the Java Collections Framework, but differs in two ways: it is tailored for primitive types, and offers immutable interfaces along with mutable ones.
Integers library is built at ALM Works and is used in our commercial software products since 2007.
Benefits
- No wrapper objects means less garbage and less overall memory consumption, which lead to shorter GC times.
- Familiar
java.util.*
-like API. - Read-only (immutable) and writable (mutable) interfaces are separated. Example: LongList and WritableLongList.
- Efficient operations on sorted sequences.
- Specialized memory-efficient implementations (e.g., LongSegmentedArray, LongSetBuilder, LongAmortizedSet).
There are other libraries out there that provide collections of primitive types, notably HPPC and Trove. They have their benefits, e.g., HPPC intentionally exposes internal structure. While integers
doesn't implement some algorithms and data structures available in other libraries, its unique advantages are cleaner API thanks to immutable interfaces, operations on sorted sequences, and specialized memory-efficient implementations. We also provide wrappers over some HPPC implementations that integers
lacks.
API
The main components of integers
are:
* Lists
* Sets
* Maps
* Iterators
See also javadoc.
How to start using integers
Most of the functionality is provided by the library core, integers.jar
(package com.almworks.integers.*
). It does not have run-time dependencies on external libraries.
Additionally, to compensate for some missing functionality, we provide implementations of integers
interfaces that wrap HPPC classes. Currently this amounts to hash maps. The wrappers are provided as a separate library, integers-wrappers.jar
(package com.almworks.integers.wrappers
). It depends on integers.jar
and HPPC. Last version of HPPC that was checked for compatibility with integers
is 0.5.2
.
Maven
Put this into your pom.xml
:
<dependency>
<groupId>com.almworks.integers</groupId>
<artifactId>integers</artifactId>
<version>1.0</version>
</dependency>
To use integers-wrappers
, add this:
<dependency>
<groupId>com.almworks.integers.wrappers</groupId>
<artifactId>integers-wrappers</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.carrotsearch</groupId>
<artifactId>hppc</artifactId>
<version>0.5.2</version>
</dependency>
Direct download
You can download the latest release here: integers-1.0.zip.
You can also download individual files: * integers.jar * Sources * Javadoc * integers-wrappers.jar * Sources for wrappers * Javadoc for wrappers
If you use wrappers, you'll want to download HPPC library.
Building from sources
See build process.
Project Information
- License: Apache License 2.0
- 4 stars
- svn-based source control
Labels:
java
commons
primitive
integer
collections
efficient
memory
Library