Is it a case of autoboxing not working on characters?
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - incompatible types
[EDIT : and also what wouter oet says below]
I dont know if this is what you intended to do.
Campbell Ritchie wrote:How did you get that Exception? Are you using code from an IDE which has already shown an error and you have told it to proceed regardless?
Yep, I didn't believe it so I told it to run anyway.
I think it means the asList() method won't accept primitive arrays as an argument.
I think you're right, but it's OK with non-primitive arrays:
No, was trying to get a List of Characters, not chars.
Rahul Sudip Bose wrote:I dont know if this is what you intended to do.
That was also a problem, but not the main one.
Wouter Oet wrote:The problem is that Arrays.asList() returns a List<T> and you're trying to assign it to an ArrayList.
Rob Spoor wrote:It would work if output would be a Character. But since the "T" generic type can only handle objects and not primitives it uses char for T.
After some more googling it seems Java doesn't have a direct way of converting primitive arrays to Lists.
In terms of the original code I have to do this: