问题
i have an outofbound exception index 1, size 1 i cant seem to find the problem here is my code:
public void removeSpellToGraveyard(ArrayList<SpellCard> spells){
for(int c=0; c<5 ; c++ ){
SpellCard r = spells.get(c);
for(int i=0; i<5;i++){
if(spellArea.get(i) == r){
graveyard.add(spellArea.remove(i));
}
}
}
}
回答1:
I'm going to provide a version of your method which achieves its apparent intent. My hope is that this will at least help you figure out what you wanted to do, if it doesn't solve your issue.
public void removeSpellToGraveyard(ArrayList<SpellCard> spells) {
for (SpellCard r: spells) {
if (spellArea.remove(r)) {
graveyard.add(r);
}
}
}
来源:https://stackoverflow.com/questions/28888569/outofboundexception-index1-size1