Hello,
The problem is in this part of the code:
The error I get is:CardBase[] tmp = new CardBase[13]; System.arraycopy(deck, range*13, tmp, 0, 13); Collections.sort(Arrays.asList(tmp));
cannot find symbol symbol : method sort(java.util.List<CardBase>) location: class java.util.Collections Collections.sort(Arrays.asList(tmp));
CardBase is an interface which looks like this:
The deck array which is being copied with System.arraycopy method to a tmp array is:
CardBase[ ] deck = new Card[52];
I know that to be able to sort items, I need to make it sortable first. Card class is the class which implements CardBase and Comparable interfaces. So from my point of view everything should be ok, but it isn't. Anyone could tell me where the mistake is? If it is not enough information, I can paste full code here.
P.S
compareTo method is ok, but I'll post it anyway:
public int compareTo(Object o) { if(o instanceof Card) { Card tmp = (Card) o; int i = this.suit.compareTo(tmp.getSuit()); if(i == 0) return this.label.compareTo(tmp.getLabel()); else return i; } return -1; }