Sorting Object with Comparator gives Null Pointer
问题 I am trying sort the ArrayList with 3 Card in it. I am doing this with a Comparator. (Is this overkill)? Card.getRank() returns an integer between 2 and 14. I have absolutely no idea where I am going wrong. I have done this successfully before, and compared with my other code, and it seems the same. I would greatly appreciate if someone could spread some light on this! public int getHand(Card c1, Card c2, Card c3) { ArrayList<Card> hand = new ArrayList<Card>(); hand.add(c1); hand.add(c2);