Browse Learn Clojure Foundations as a Java Developer

Java Lambdas and Clojure Functions

Compare Java lambdas, method references, and functional interfaces with Clojure fn forms, anonymous-function shorthand, named functions, and direct function values.

Java and Clojure can both express “pass behavior to another function”, but the default style looks different.

  • In Java, lambdas are strongly typed and usually tied to a functional interface (Function, Predicate, etc.).
  • In Clojure, functions are values, and you typically pass a var (named function) or an anonymous fn.
1(map (fn [x] (* x 2)) [1 2 3])
2(map #(* % 2) [1 2 3])

Practical guidance

  • Use the shorthand #() when it stays short and readable.
  • Prefer a named function when the logic has a real name or is more than a couple of expressions.

Java mental model: method references and lambdas map well to passing vars and anonymous functions, but Clojure encourages smaller functions and more composition.

The goal is not to memorize syntax. It is to pick the form that makes the pipeline easiest to read and maintain.

In this section

Revised on Saturday, May 23, 2026