February 2018
Intermediate to advanced
304 pages
7h 11m
English
Clojure provides simple, direct syntax for calling Java code: creating objects, invoking methods, and accessing static methods and fields. In addition, Clojure provides syntactic sugar that makes calling Java from Clojure more concise than calling Java from Java!
Not all types in Java are created equal: the primitives and arrays work differently. Where Java has special cases, Clojure gives you direct access to these as well. Finally, Clojure provides a set of convenience functions for common tasks that would be unwieldy in Java.
The first step in many Java interop scenarios is creating a Java object. Clojure provides the new special form for this purpose:
| | (new classname) |
Try creating a new Random:
| | (new java.util.Random) |
| | -> ... |
Read now
Unlock full access