2014-05-02 21:37:11 +00:00
|
|
|
(ns koans.19-java-interop
|
|
|
|
(:require [koan-engine.core :refer :all]))
|
2014-01-26 00:04:22 +00:00
|
|
|
|
2011-07-08 20:57:44 +00:00
|
|
|
(meditations
|
|
|
|
"You may have done more with Java than you know"
|
|
|
|
(= __ (class "warfare")) ; hint: try typing (javadoc "warfare") in the REPL
|
|
|
|
|
|
|
|
"The dot signifies easy and direct Java interoperation"
|
|
|
|
(= __ (.toUpperCase "select * from"))
|
|
|
|
|
|
|
|
"But instance method calls are very different from normal functions"
|
|
|
|
(= ["SELECT" "FROM" "WHERE"] (map ___ ["select" "from" "where"]))
|
|
|
|
|
|
|
|
"Constructing might be harder than breaking"
|
|
|
|
(= 10 (let [latch (java.util.concurrent.CountDownLatch. __)]
|
|
|
|
(.getCount latch)))
|
|
|
|
|
|
|
|
"Static methods are slashing prices!"
|
|
|
|
(== __ (Math/pow 2 10)))
|