λ dmx-fun

A functional programming library for Java

Pure Functions

Build reliable and testable code with pure functional programming principles.

🔄

Immutability

Work with immutable data structures to avoid side effects and race conditions.

🎯

Type Safety

Leverage Java's type system for compile-time guarantees and safer code.

🛠️

Rich API

Comprehensive collection of functional utilities for everyday programming tasks.

📦

Zero Dependencies

Lightweight library with no external dependencies, easy to integrate.

🚀

Production Ready

Battle-tested in production environments with comprehensive test coverage.

Quick Example

QuickExample.java
import codes.domix.fun.Option;
import codes.domix.fun.Try;
import java.util.function.Function;
public class QuickExample {
record User(String name, String email, String password) {
}
Function<String, Option<User>> findUser = email
-> Option.some(new User("User", email, "secret"));
private String getUserName(String email) {
// Handle options safely
return findUser.apply(email)
.map(User::name)
.getOrElse("Anonymous");
}
private void parseInt(String name) {
// Handle errors functionally
Try.of(() -> Integer.parseInt(name))
.recover(throwable -> {
System.out.println("Error parsing: " + throwable.getMessage());
return 0;
})
.onSuccess(System.out::println);
}
}

Ready to Get Started?

Add functional programming power to your Java projects today.

View Documentation