Clojure: what's the difference between [D and [Ljava.lang.Double;?

Viewed 1369

I'm trying to do some stuff with native Java arrays, and I'm not understanding what the difference is between the two double-array instantiations. Does this have to do with boxing and unboxing values? In all cases below the (first...) of every array has type java.lang.Double. Clojure protocols appear to be sensitive to the distinction.

user> (class (make-array Double/TYPE 3))  ;; [D
user> (class (double-array [1 2 3]))      ;; [D
user> (class (into-array (make-array Double/TYPE 3)))  ;; [Ljava.lang.Double;
user> (class (into-array (double-array [1 2 3])))      ;; [Ljava.lang.Double;
user> (class (into-array (repeat 2 (double-array [1 2 3]) ))) ;; [[D
3 Answers
Related