private static int compareTo ( Deque < String > first , Deque < String > second ) { if ( 0 == first . size ( ) && 0 == second . size ( ) ) { return 0 ; } if ( 0 == first . size ( ) ) { return 1 ; } if ( 0 == second . size ( ) ) { return - 1 ; } int headsComparation = ( Integer . valueOf ( first . remove ( ) ) ) . compareTo ( Integer . parseInt ( second . remove ( ) ) ) ; if ( 0 == headsComparation ) { return compareTo ( first , second ) ; } else { return headsComparation ; } }
Compares two string ordered lists containing numbers .