What is the syntax for a type hint for java.util.Map.Entry
, a nested static inner class, in Clojure 1.2?
I tried both ^Map/Entry
and ^Map.Entry
, and neither will compile.
Found it!
(ns com.example
(:import [java.util Map Map$Entry]))
(let [^Map$Entry foo ...])
and for type-hinting an Object[]
:
(let [^"[Ljava.lang.Object;" foo ...])
BTW, that's some ugly syntax. Is there a better way?
Inner classes are referred by $
sign, so, in this case, you can refer to it from Clojure as Map$Entry
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With