View Single Post
  #1 (permalink)  
Old 07-16-2007, 06:38 PM
paul paul is offline
Member
 
Join Date: Jul 2007
Posts: 26
paul is on a distinguished road
Problem with LinkedList Java
I have 2 lists linkedlist and linkedlist2.
I want to be able to take out the first Card out of linkedlist (which starts at 0) and add it to linkedlist2. Then once that is done i want to remove Card 0 from linkedlist, and i want to be able to do this for as many times as i assign to the integer n.

however the part that i bolded doesn't work so how do i do it?

Code:
public Deck split(int n) { //implement LinkedList<Card> linkedlist= new LinkedList<Card>(); LinkedList<Card> linkedlist2= new LinkedList<Card>(); int i = n; while (i > 0){ linkedlist2.add(linklist<0>); linkedlist.remove(0); i--;}
Thanks
Reply With Quote
Sponsored Links