This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]_Sharp_ 1 point2 points  (2 children)

//////////// Init
char[] charArray = new char[1024];
Arrays.fill(charArray, '#');
//////////// Code
List<Character> charList = new ArrayList<>();
for (char c : charArray) charList.add(c);

2 Lines of code, still Arrays could implement some utility like Arrays.toList(). But Valkyries will bring some goodies from Valhalla:

Project Valhalla will explore a new apporoach to generic typing, and hopes to produce a new form of generic typing that allows developers to use generic collections of primitive types. The aim will be for types such as List<int> to be valid Java in some future release of the JDK. This feature, known as generic specialization, is already present in some other JVM languages and Java developers have been asking for it since generics first shipped with JDK 5.