44import java .math .BigDecimal ;
55import java .util .ArrayDeque ;
66import java .util .ArrayList ;
7+ import java .util .Collection ;
78import java .util .HashMap ;
89import java .util .List ;
910import java .util .Map ;
@@ -123,7 +124,7 @@ private static BigDecimal handleHundred(BigDecimal currentChunk, String word, bo
123124 return currentChunk .multiply (BigDecimal .valueOf (100 ));
124125 }
125126
126- private static void handlePowerOfTen (List <BigDecimal > chunks , BigDecimal currentChunk , BigDecimal powerOfTen , String word , boolean prevNumWasPowerOfTen ) {
127+ private static void handlePowerOfTen (Collection <BigDecimal > chunks , BigDecimal currentChunk , BigDecimal powerOfTen , String word , boolean prevNumWasPowerOfTen ) {
127128 boolean currentChunkIsZero = currentChunk .compareTo (BigDecimal .ZERO ) == 0 ;
128129 if (currentChunkIsZero || prevNumWasPowerOfTen ) {
129130 throw new WordsToNumberException (WordsToNumberException .ErrorType .UNEXPECTED_WORD , word );
@@ -136,7 +137,7 @@ private static void handlePowerOfTen(List<BigDecimal> chunks, BigDecimal current
136137 chunks .add (nextChunk );
137138 }
138139
139- private static BigDecimal handleNumber (List <BigDecimal > chunks , BigDecimal currentChunk , String word , Integer number ) {
140+ private static BigDecimal handleNumber (Collection <BigDecimal > chunks , BigDecimal currentChunk , String word , Integer number ) {
140141 boolean currentChunkIsZero = currentChunk .compareTo (BigDecimal .ZERO ) == 0 ;
141142 if (number == 0 && !(currentChunkIsZero && chunks .isEmpty ())) {
142143 throw new WordsToNumberException (WordsToNumberException .ErrorType .UNEXPECTED_WORD , word );
0 commit comments