horse_badorties
07/30/2017, 8:22 AMArray
in the first place? Why not use Collection
and let the compiler optimize them away as JVM Arrays where possible?voddan
07/30/2017, 11:13 AMvoddan
07/30/2017, 11:14 AMvoddan
07/30/2017, 11:14 AMArrayList
horse_badorties
07/30/2017, 2:11 PMArrayList
is a ☕ class, not a K class, so I'm not sure why that would be relevant.diesieben07
07/30/2017, 2:28 PMCollection
by compiler magic.voddan
07/30/2017, 3:54 PMCollection
is an interface, Array
is a class, one can't replace the other.voddan
07/30/2017, 3:55 PMArrayList
as an example of a List
which is indeed very optimized by JVMhorse_badorties
07/30/2017, 8:14 PMArray
altogether and only provide the Collection
type hierarchy - an Array being essentially a mutable, fixed-sized List.
I have yet to understand your "Arrays are here because Java has them, and thus K has to express this concept."
I'm not saying you are wrong, but I still don't really understand the "why". 🙂diesieben07
07/30/2017, 8:16 PMhorse_badorties
07/30/2017, 8:18 PMArray
type?diesieben07
07/30/2017, 8:26 PMArrayList
is a high-level implementation. You need low-level building blocks (like arrays) for when you need performance or exact control.diesieben07
07/30/2017, 8:27 PMAtomicReferenceArray
is not possible if you don't have arrays.horse_badorties
07/30/2017, 8:30 PMhorse_badorties
07/30/2017, 8:30 PMArray
is only one-dimensional, so it doesn't even "express the complete concept" of JVM/Java Arrays.diesieben07
07/30/2017, 8:37 PMdiesieben07
07/30/2017, 8:38 PMArray<Array<String>>
works fine.horse_badorties
07/30/2017, 8:38 PMdiesieben07
07/30/2017, 8:39 PMhorse_badorties
07/30/2017, 8:41 PMdiesieben07
07/30/2017, 8:41 PMvoddan
07/30/2017, 9:12 PMArrays are here because Java has them, and thus K has to express this concept.Consider if java exposes overloads
test(String[] x)
and test(List<String> y)
, how do you call one over the other if you can't provide an array?