• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

arraylist problem

 
Lim Youjie
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My array is working fine but when i try to change to arraylist, i encounter an error msg. Can anybody help me?
thanks.

Using array:
deck[currentPosition] = deck[swapPosition];

Change to arraylist
deck.get(currentPosition) = deck.get(swapPosition)
error msg:unexpected type;required: variable,found
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lim Youjie:
My array is working fine but when i try to change to arraylist, i encounter an error msg. Can anybody help me?
thanks.

Using array:
deck[currentPosition] = deck[swapPosition];

Change to arraylist
deck.get(currentPosition) = deck.get(swapPosition)
error msg:unexpected type;required: variable,found


deck.set(currentPosition, deck.get(swapPosition));

http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lim, take the Collections Framework tutorial. There's a lot of good stuff
in this framework, and you'll be glad you learned it:

Collections Tutorial
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic