• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cloning an ArrayList of ArrayStacks of Objects  RSS feed

 
Joe Lalli
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm programming a Free Cell game, and I decided to use an ArrayList of ArrayStacks, with each ArrayStack containing Cards to represent the board. Each column of cards is basically a stack, and the board is comprised of 8 of those columns, so I decided to store those in an ArrayList. I'm starting to think I should have stored them in a plain array, but you guys can tell me if that was wise or not.

The Card class I'm pretty sure is fine, but the ArrayStack and ArrayList are a little off.

Here's some of my code:



Sorry if my code's a little illegible, I'll explain anything you want. But that's the clone method of my ArrayStack. Here's how I'm copying the ArrayList of ArrayStacks:



For good measure, here's the clone method of card:



I get the weirdest error. It'll run upto the copy point, lag for about 2 seconds, then just say "Exception in thread Main". Even though at the copy point in both have e.printStackTrace();, which would suggest it's not a CLoneNotSupported Exception.

Any help?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!