Is it possible to cast an int array to a char array? If so - how?
I'm currently working on a project where I need to create an char array containing the alphabet. My current code creats an int array (which should be converted to an char array - in one Line!):
return IntStream.range('a', 'z' + 1).toArray();
Character.forDigit(a, 10);.int[]tochar[]. Also, your current code doesn't work, so it doesn't matter how short it is. First rule of optimization: It has to work. Since Java 8 doesn't have aCharStream, you should do it with a normalforloop. It only takes 3 lines of code (4 with return statement), and it works!