private int compareHandsOfSameType(FiveCardPokerHand o1, FiveCardPokerHand o2, PokerHandType handType) {        
        if (o1.getNumberOfCards() != 5 || o2.getNumberOfCards() != 5) {
            throw new IllegalArgumentException("One of the hands doesn't have five cards!");
        }
        List<Card> cards1 = o1.getCards();
        List<Card> cards2 = o2.getCards();
        Collections.sort(cards1);
        Collections.sort(cards2);
        
        switch (handType) {
            case HIGH_CARD:
                return checkBetterFlushOrHighCard(cards1, cards2);
            case PAIR:
                return checkBetterPairedHand(cards1, cards2);
            case TWO_PAIR:
                return checkBetterPairedHand(cards1, cards2);
            case THREE_OF_A_KIND:
                return checkBetterPairedHand(cards1, cards2);                
            case STRAIGHT:
                return checkBetterStraightOrStraightFlush(cards1, cards2);            
            case FLUSH:
                return checkBetterFlushOrHighCard(cards1, cards2);    
            case FULL_HOUSE:
                return checkBetterPairedHand(cards1, cards2);   
            case FOUR_OF_A_KIND:
                return checkBetterPairedHand(cards1, cards2);                  
            case STRAIGHT_FLUSH:
                return checkBetterStraightOrStraightFlush(cards1, cards2);    
            default:
                throw new RuntimeException("invalid handType");
        }
        
    }