ClassCastException, PVectors and classes
in
Programming Questions
•
1 year ago
Hello all,
I've set up an ArrayList of Node class objects. I'm running a simple for loop to grab each one, but when I run this:
Node nm = (Node) nodes.get(m);
if's giving me a ClassCastException saying that PVector cannot be cast into Node. The problem is that I'm not casting PVector and Node is not holding a PVector.
The other strange part is I have almost the exact same line of code about 10 lines before:
Node nodej = (Node) nodes.get(j);
and it works just fine.
I know it's hard to give me a specific answer without all of my code. I can dump it here if I need to, but I was just hoping for a first stab at why this might be.
Also, I can call specific Node objects. If I change the "m" to a number : nodes.get(0), it works. What gives?
Thanks.
Justin
1