package cards;

import java.util.*;

public class Hand implements Comparable<Hand> {
    public enum Hands {
        HIGH_CARD("High Card"),
        ONE_PAIR("One Pair"),
        TWO_PAIR("Two Pair"),
        THREE_OF_A_KIND("Three of a Kind"),
        STRAIGHT("Straight"),
        FLUSH("Flush"),
        FULL_HOUSE("Full House"),
        FOUR_OF_A_KIND("Four of a Kind"),
        STRAIGHT_FLUSH("Straight Flush");

        private String output;

        private Hands(String o) {
            output = o;
        }

        @Override
        public String toString() {
            return output;
        }
    }

    private Hands handRank;
    private List<Card> cards = new ArrayList<Card>();

    public Hand() {};

    public Hand(Hands h, List<Card> c) {
        handRank = h;
        cards.addAll(c);
    }

    public void setHandRank(Hands h) {
        handRank = h;
    }

    public Hands getHandRank() {
        return handRank;
    }

    public void add(Card c) {
        cards.add(c);
    }

    public void addAll(List<Card> c) {
        cards.addAll(c);
    }

    public List<Card> getCards() {
        return cards;
    }

    public void setHandStreak(int streak) {
        switch (streak) {
            case 2:
                handRank = Hands.ONE_PAIR;
                break;
            case 3:
                handRank = Hands.THREE_OF_A_KIND;
                break;
            case 4:
                handRank = Hands.FOUR_OF_A_KIND;
                break;
        }
    }

    @Override
    public String toString() {
        return handRank.toString() + ": " + cards.toString();
    }

    @Override
    public int compareTo(Hand b) {
        if (b == null) {
            return 1;
        }

        return -getHandRank().compareTo(b.getHandRank());
    }
}

@@ -1671,20 +1671,97 @@
    i
-f (b == null
+nt handCompare = -getHandRank().compareTo(b.getHandRank());%0A%0A        if (handCompare != 0
 ) %7B%0A
@@ -1783,9 +1783,19 @@
 urn 
-1
+handCompare
 ;%0A  
@@ -1793,33 +1793,39 @@
 mpare;%0A        %7D
-%0A
+ else %7B
 %0A        return 
@@ -1821,57 +1821,348 @@
     
-return -getHandRank().compareTo(b.getHandRank());
+    List%3CCard%3E aList = getCards();%0A            List%3CCard%3E bList = b.getCards();%0A%0A            for (int i = 0; i %3C aList.size(); i++) %7B%0A                int compare = -aList.get(i).compareTo(bList.get(i));%0A%0A                if (compare != 0) %7B%0A                    return compare;%0A                %7D%0A            %7D%0A%0A            return 0;%0A        %7D
 %0A   

Correct logic for tie breaking hands