kludge n. Slang

A system, especially a computer system, that is constituted of poorly matched elements or of elements originally intended for other applications.

KλudJe is a Java lambda API for use with Java 8. If you aren't familiar with lambdas see the Java lambda expression tutorial.

KλudJe is published under the Apache 2.0 license.


Binaries are published to the Central Repository.

Maven dependecy:



Sources are available via the KλudJe project page.


Latest Javadoc: KλudJe 0.6 API.


Simple equals, hashCode and toString

The Meta type can be used to define simple implementations of three basic Java methods:


Significant properties can be defined a single time.

See the API documentation for more on usage and limitations.

Checked Exception Propagation

This code demonstrates how to throw and catch the checked IOException without using a throws declaration in a method:


With more than one checked exception type:


The next example demonstrates how this is useful.

Line Count Example

Consider this interface contract that takes a collection of files and returns the number of lines in them:


Here is a traditional imperative implementation:


Let's refactor to a parallel streaming implementation:


The above code is unsatisfactory. In order to obey the interface contract IOException must be wrapped and unwrapped using UncheckedIOException.

This problem can be addressed using a cast to KλudJe's UFunction to transparently pass the exception to the calling method:


UFunction extends java.util.function.Function. KλudJe provides types that extend many of the standard Java functional interfaces in the same way. See the API for more details.

The static UFunction.asUFunction method can be used for type inference to avoid having to specify the generic types:


Checked Exception Handling With Arbitrary Functional Interfaces

The previous example assumes the use of the standard Function interface. However, arbitrary interfaces can be provided using method references. KλudJe provides a few n-ary interface types to add exception handling to cover cases where the standard API doesn't.

An example of using a method handle that throws a checked exception with an arbitrary 3-argument functional interface:



Here Be Dragons

When using this API there are a few things to be aware of.

When using Exceptions.throwChecked or code that uses it (e.g. UFunction) you cannot rely on the compiler to flag uncaught checked exceptions. This will defy the expectations of many Java developers. It is recommended to document usage and intent.

The n-ary types provided can be used with functional interfaces/method references that use primitives. Autoboxing concerns are left to the developer.