i'm having trouble with a type cas error, and i can't find out why it keeps poping...
Error message : [Ljava.lang.Object; cannot be cast to [Lnet.masterthought.cucumber.json.Stuff;
it pops on the line this.stuffs = (Stuff[]) sList.toArray();
Anyone has any idea what's the problem ?
public class Element {
private Stuff[] stuff;
//... getters setters
public function updateStuff(Stuff[] newStuff) {
Map<String, Stuff> stuffMap = new HashMap<String, Stuff>();
for (Stuff s : this.stuffs) {
stuffMap.put(s.getName(), s);
}
for (Stuff s : prevStuffs) {
if (stuffMap.containsKey(s.getName())) {
stuffMap.get(s.getName()).setValue(s.getValue());
}
}
ArrayList<Stuff> sList = new ArrayList<Stuff>(stuffMap.values());
this.stuffs = (Stuff[]) sList.toArray();
}
}