View Single Post
  #3 (permalink)  
Old 08-07-2007, 06:57 AM
coco coco is offline
Member
 
Join Date: Jul 2007
Posts: 39
coco is on a distinguished road
Gox is right:
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(linkedlist.get(0)); linkedlist.remove(0); i--; }
You could also change it to

Code:
linkedlist2.add(linkedlist.poll());
There are a whole bunch of different ways to do it so I suggest looking at the API
Reply With Quote