Specialized efficient data structures for Java
Dedicated check list and check table data structures.
Check lists and check tables take a set of items as input; initially, all items will be marked as unchecked. You can then use the various methods to mark individual items as checked. Further methods allow you to check whether your check list or check table is complete - and when not, what is missing.
A check list is a one-dimensional list, a check table is a two-dimensional matrix.
One typical use case for these data structures are complex access control rules. You can use
a check table to tick off what privileges are present and which are not present. The tabular
toString()
representation helps quickly identifying what privileges are missing:
| indices:data/read/search |
index_a11| ok |
index_a12| MISSING |
index_a13| MISSING |
index_a14| MISSING |
Builder classes that allow you to create sub-sets of existing Set<>
objects in Java. The sub-sets are represented by
bitfields, thus they can be extremely space efficient. Efficient deduplication of equal sub-sets is also possible.
Builder classes that allow you to create groups of maps that share a common super-set of keys. The produced maps may share their key hash tables and only explicitly specify the value tables. Thus, these maps take about 50% less heap than normal maps.
An immutable set implementation which assigns ordinal numbers to its member elements. It exposes the
methods elementToIndex()
and indexToElement()
which provide fast O(1) means to convert an element to its index and
vice-versa. This implementation is used internally by checklists
, compact-subsets
and compact-maps
.
Bare specialized Java interfaces for collections. Includes UnmodifiableCollection
, UnmodifiableSet
, UnmodifiableList
.
This code is licensed under the Apache 2.0 License.
Copyright 2024 Nils Bandener [email protected]
Partially based on fluent collections which is Copyright 2022 by floragunn GmbH: https://git.floragunn.com/util/fluent-collections