aspose file tools*
The moose likes Beginning Java and the fly likes arraylist problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "arraylist problem" Watch "arraylist problem" New topic
Author

arraylist problem

Lim Youjie
Greenhorn

Joined: Dec 27, 2004
Posts: 22
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

Joined: Sep 24, 2003
Posts: 1608
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


Tony Morris
Java Q&A (FAQ, Trivia)
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
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


There is no emoticon for what I am feeling!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: arraylist problem
 
Similar Threads
Schema handling
Blackjack program not good with random cards
Writing recursive generated data to csv or text
Sending data from an ArrayList to a file
newbie help please with arrays