|
| 1 | +# fastutil4k |
| 2 | + |
| 3 | +Kotlin-first utilities built on top of [fastutil](https://fastutil.di.unimi.it/). |
| 4 | + |
| 5 | +This repository is a multi-module Gradle project: |
| 6 | + |
| 7 | +- `fastutil4k-extensions-only`: generated and hand-written inline Kotlin extension APIs for fastutil and JDK collections. |
| 8 | +- `fastutil4k-more-collections`: additional collection implementations built with fastutil data structures. |
| 9 | + |
| 10 | +## Modules |
| 11 | + |
| 12 | +### `fastutil4k-extensions-only` |
| 13 | + |
| 14 | +Provides a large set of extension helpers in package `net.ccbluex.fastutil`, including: |
| 15 | + |
| 16 | +- collection wrappers: `synchronized()` and `unmodifiable()` |
| 17 | +- pair helpers: `pair`, `mutPair`, `refPair`, destructuring support |
| 18 | +- primitive/object list, set, and map factories |
| 19 | +- typed iteration helpers: `forEachInt`, `forEachDoubleIndexed`, `onEachLong`, etc. |
| 20 | +- typed array mapping helpers: `mapToIntArray`, `mapToArray`, ... |
| 21 | +- function-like operators for fastutil functional interfaces: |
| 22 | + `UnaryOperator.invoke`, `BinaryOperator.invoke`, `Predicate.invoke`, `Consumer.invoke` |
| 23 | + |
| 24 | +Most APIs are generated under: |
| 25 | + |
| 26 | +- `fastutil4k-extensions-only/build/generated/fastutil-kt` |
| 27 | + |
| 28 | +The module is designed to be used as `compileOnly` in downstream projects. |
| 29 | + |
| 30 | +### `fastutil4k-more-collections` |
| 31 | + |
| 32 | +Provides higher-level collection utilities and data structures, including: |
| 33 | + |
| 34 | +- `Pool<E>`: reusable object pool with optional finalizer and synchronized wrapper |
| 35 | +- `LfuCache<K, V>`: non-thread-safe LFU cache with LRU tie-breaking |
| 36 | +- `WeightedSortedList<E>`: bounds-checked list sorted by element weight |
| 37 | +- stepped float/double ranges returning fastutil lists (`ClosedRange<Double>.step`, `ClosedRange<Float>.step`) |
| 38 | + |
| 39 | +## Requirements |
| 40 | + |
| 41 | +- JDK 8+ (toolchain target is Java 8) |
| 42 | +- Gradle Wrapper (included) |
| 43 | + |
| 44 | +## Build |
| 45 | + |
| 46 | +```bash |
| 47 | +./gradlew clean build |
| 48 | +``` |
| 49 | + |
| 50 | +## Regenerate extension sources |
| 51 | + |
| 52 | +Generated extension sources are produced by module tasks in `fastutil4k-extensions-only`. |
| 53 | + |
| 54 | +```bash |
| 55 | +./gradlew :fastutil4k-extensions-only:generate-all |
| 56 | +``` |
| 57 | + |
| 58 | +## Dependency coordinates |
| 59 | + |
| 60 | +Group: |
| 61 | + |
| 62 | +- `net.ccbluex` |
| 63 | + |
| 64 | +Artifacts: |
| 65 | + |
| 66 | +- `fastutil4k-extensions-only` |
| 67 | +- `fastutil4k-more-collections` |
| 68 | + |
| 69 | +Version is defined in the root build script (`build.gradle.kts`). |
| 70 | + |
| 71 | +## License |
| 72 | + |
| 73 | +MIT. See [LICENSE](LICENSE). |
0 commit comments