I'm trying to make a linked-list representation of Deque , each node of the linked list is defined by an instance of the inner class Node , but I'm getting this :
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [LRandomizedQueue$Node;
I dony know how to work this out. This is what i had:
private class Node {
Item item;
Node next;
Node prev;
}
@SuppressWarnings("unchecked")
private Node[] nd = (Node[]) new Object[100];
Can someone please tell me what i'm doing wrong , and help me figure this out ? Thanks a lot for your time.
Edit: It seems i had things confused with creating a generic array vs an array of an inner class. Thanks a lot for the replies.
Object[]and trying to cast it to aNode[]. Would you expectNode node = (Node) new Object()to work?