Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ArrayList.subList() problem

843785Feb 19 2009 — edited Feb 21 2009
hi,
i'm getting to few items back from the call to subList(). i know that the 'to' index is excluded but i just can't see what i'm doing wrong. any salient help, or better eyes, will be greatly appreciated. thanks.

n
        public static void dealHands(){
                NUMBER_OF_CARDS = 5;j = 0;
                Collections.shuffle(cardDeck);
                for(i=0;i<7;i++){
                        Set<PlayingCard> temp = new TreeSet<PlayingCard>();
                        temp.addAll(cardDeck.subList(j,j+NUMBER_OF_CARDS));
                        Iterator<PlayingCard> it = temp.iterator();
                        while(it.hasNext())
                                System.out.println(it.next().toString());
                        j+=5;
                }


        }
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 21 2009
Added on Feb 19 2009
18 comments
194 views