That was very informative, thank you.
Replacing the error line with Arrays.sort(tmp) solved the problem.
By the way, in one of your link I saw pretty much the same way of sorting as I did:
Code:
String[] strArray = new String[] {"z", "a", "C"};
Arrays.sort(strArray, String.CASE_INSENSITIVE_ORDER);
Collections.reverse(Arrays.asList(strArray));
Speaking about Comparable implementation, CardBase is actually an interface which looks like this:
Code:
public interface CardBase {
public int compareTo(Object o);
public Suit setSuit();
public Suit getSuit();
public String getShortSuit();
}
The deck array which is being copied with System.arraycopy method to a tmp array is:
Code:
CardBase[ ] deck = new Card[52];
Card class is the class which implements CardBase and Comparable interfaces. So from my point of view everything should be ok, but still isn't.