Hi, everyone, first let me explain I'm new to forums so if I'm doing something wrong - sorry. Here's my question:
On the following line of code
LinkedList<DecoratedNode>[] dial = (LinkedList<DecoratedNode>[]) new Object[C+1];
I get java.lang.ClassCastException: [Ljava.lang.Object;
I'm actually trying to create an array of size C+1 of linked lists, and the linked lists have objects of type DecoratedNode as elements. The code actually compiles, but it gives that error message when I try to run the
JUnit test for it.
If anyone has an idea why it's not working please help. Thank you!
P.S. When I try to do
LinkedList<DecoratedNode>[] dial = new LinkedList<DecoratedNode>[C+1];
I get the error message "generic array construction"