Example of how to use FunctionalJ in a Gradle project.
It basically boils down to adding the required maven repository (hosted by github).
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation 'io.functionalj:functionalj-all:1.0.25' // Please look up the latest version.
annotationProcessor 'io.functionalj:functionalj-types:1.0.25' // Please look up the latest version.
}See the full code here: build.gradle
Three small, runnable examples live under src/main/java/use/functionalj/gradle:
| Example | Class | Demonstrates |
|---|---|---|
run-choice |
TryChoice |
@Choice — algebraic/sum types (a Tree of Node/Leaf), plus lazy IntStreamPlus ranges |
run-struct |
TryStruct |
@Struct — immutable data types (Buyer, Order, Item), filtered/grouped with FuncList |
run-list |
list.TryFuncList |
FuncList — functional operations (filter, mapToInt, average) over a plain list |
- JDK 21 (see
.java-version) - Gradle — or just use the bundled
./gradlew
No local install needed: this repo ships a CodingBooth config (.booth/) that launches a ready-to-go dev environment — JDK 21, Gradle, and both Eclipse and IntelliJ IDEA pre-wired to open this project automatically, no manual import. Run ./booth to start it.
With just (already installed in the booth):
just # list available recipes
just build # ./gradlew build
just test # ./gradlew test
just clean # ./gradlew clean
just run-choice # run the @Choice example
just run-struct # run the @Struct example
just run-list # run the FuncList exampleOr drive Gradle directly with ./gradlew build, ./gradlew test, etc.