Andreas Huber c9dcbdbe97 performance improvements
the heap refill code was recursively implemented with two methods.
I merged both methods.

replace recursion in heap refill method with iterative approach

use array for list of LongQueue
This way there is no precondition when accessing the elements
2020-11-07 08:36:07 +01:00
2020-11-05 17:53:47 +01:00
2020-11-07 08:36:07 +01:00
2020-11-05 17:53:47 +01:00
2020-11-05 17:53:47 +01:00
2017-02-04 09:10:28 +01:00
2018-11-20 19:57:31 +01:00
2018-05-19 19:50:19 +02:00

Java collections for primitives (currently only int) released under MIT license.

IntList and LongList are implementations of lists that store primitive integers/longs. The ints/longs are stored in an int/long array and the class takes care of growing the array as needed. You can trim the list to reduce the memory overhead. No dependencies.

The lists support the following operations:

  • add/remove elements via single and bulk operations
  • replace elements
  • sort and shuffle
  • the lists know whether or not they are sorted and can leverage that knowledge for searching (binary search), union and intersection
  • search for elements
  • union, intersection, retainIf, retainAll removeIf, removeAll
  • clear and trim are separate methods, so that the list can be re-used without having to re-allocate memory
  • stream support
  • the lists are serializable and cloneable
  • the lists are not thread-safe

How to use

The library is still considered beta. There no pre-build artifacts on Maven Central or JCenter, but you can download them from repo.lucares.org.

Example for Gradle:

apply plugin: 'maven'
repositories {
	maven { url 'https://repo.lucares.org/' }
}
dependencies {
	compile 'org.lucares:primitiveCollections:0.1.20181120195412'
}

Examples

import org.lucares.collections.IntList;

public class Example {
	public static void main(final String[] args) {
		final IntList list = IntList.of(1, 3, 5);
		System.out.println(list + " is sorted: " + list.isSorted());

		list.insert(2, 7);
		System.out.println(list + " is sorted: " + list.isSorted());

		list.sort();
		System.out.println(list + " is sorted: " + list.isSorted());
	}
}

Running this program gives the following output:

[1, 3, 5] is sorted: true
[1, 3, 7, 5] is sorted: false
[1, 3, 5, 7] is sorted: true
Description
No description provided
Readme MIT 667 KiB
Languages
Java 99.9%
Shell 0.1%