Okay, I'm crap at solving casting problems... I try, but...
I've got an ArrayList that I'm trying to convert to an Atom using the .toArray() provided by ArrayList. Seems simple enough, but...
Atom stuff = theList.toArray();
fails to compile (needs Atom, finds Object) No problem.
Atom stuff = (Atom)theList.toArray();
compiles, but fails with a ClassCastException in at runtime
I know what's going on, but I can't get the syntax. The "theList" is being created as ArrayList, so I don't get what's up.
Ha! Found it, but I'll post all this anyway, for any other unfortunate souls stumbling into similar confusion:
Atom stuff = theList.toArray(new Atom[theList.size()]);