Clojure tooltip type for Map.Entry

What is the syntax of 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 will not compile.

+6
clojure type-hinting
source share
2 answers

Found it!

 (ns com.example (:import [java.util Map Map$Entry])) (let [^Map$Entry foo ...]) 

and for the hint type Object[] :

 (let [^"[Ljava.lang.Object;" foo ...]) 

By the way, this syntax is ugly . Is there a better way?

+10
source share

Inner classes refer to the $ sign, so in this case you can refer to it with Clojure as Map$Entry .

+3
source share

All Articles