Kotlin-first utilities built on top of fastutil.
This repository is a multi-module Gradle project:
fastutil4k-extensions-only: generated and hand-written inline Kotlin extension APIs for fastutil and JDK collections.fastutil4k-more-collections: additional collection implementations built with fastutil data structures.benchmark: JMH benchmarks for local performance measurement (not published).
Provides a large set of extension helpers in package net.ccbluex.fastutil, including:
- collection wrappers:
synchronized()andunmodifiable() - pair helpers:
pair,mutPair,refPair, destructuring support - primitive/object list, set, and map factories
- typed iteration helpers:
forEachInt,forEachDoubleIndexed,onEachLong, etc. - typed array mapping helpers:
mapToIntArray,mapToArray, ... - function-like operators for fastutil functional interfaces:
UnaryOperator.invoke,BinaryOperator.invoke,Predicate.invoke,Consumer.invoke
Most APIs are generated under:
fastutil4k-extensions-only/build/generated/fastutil-kt
The module is designed to be used as compileOnly in downstream projects.
Provides higher-level collection utilities and data structures, including:
Pool<E>: reusable object pool with optional finalizer and synchronized wrapperLfuCache<K, V>: non-thread-safe LFU cache with LRU tie-breakingWeightedSortedList<E>: bounds-checked list sorted by element weight- weighted terminal operations for
Iterable/Sequence:weightedFilterSortedBy*,weightedMinByOrNull*,weightedMaxByOrNull* - stepped float/double ranges returning fastutil lists (
ClosedRange<Double>.step,ClosedRange<Float>.step)
Independent JMH module for performance testing:
- core benchmarks for
Pool,LfuCache,WeightedSortedList,Ranges - transform benchmark:
mapToArray { }.asList()vscollection.mapvssequence.map.toListvsstream.map.toList - not part of publish artifacts
- JDK 8+ (toolchain target is Java 8)
- Gradle Wrapper (included)
./gradlew clean buildbenchmark is intentionally skipped in normal build/check/test lifecycle.
# Compile JMH sources
./gradlew :benchmark:compileJmhKotlin
# Smoke run (single benchmark class, short run)
./gradlew :benchmark:jmh --no-configuration-cache \
-Pjmh.includes=MapTransformBenchmark \
-Pjmh.warmupIterations=1 \
-Pjmh.iterations=1 \
-Pjmh.fork=1
# Full benchmark suite
./gradlew :benchmark:jmh --no-configuration-cacheJMH JSON output path:
benchmark/build/reports/jmh/results.json
Generated sources are produced by module tasks.
./gradlew :fastutil4k-extensions-only:generate-all
./gradlew :fastutil4k-more-collections:weighted-terminalGroup:
net.ccbluex
Artifacts:
fastutil4k-extensions-onlyfastutil4k-more-collections
Version is defined in the root build script (build.gradle.kts).
MIT. See LICENSE.