for (Iterator<Suit> i = suits.iterator(); i.hasNext(); ) { for (Iterator<Rank> j = ranks.iterator(); j.hasNext(); ) { deck.add(newCard(i.next(), j.next())); } }
} }
실행결과
1 2 3 4 5 6
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Arrays$ArrayItr.next(Arrays.java:4431) at com.github.sejoung.codetest.general.Card.main(Card.java:27)
CLUB : ACE CLUB : DEUCE CLUB : THREE CLUB : FOUR CLUB : FIVE CLUB : SIX CLUB : SEVEN CLUB : EIGHT CLUB : NINE CLUB : TEN CLUB : JACK CLUB : QUEEN CLUB : KING DIAMOND : ACE DIAMOND : DEUCE DIAMOND : THREE DIAMOND : FOUR DIAMOND : FIVE DIAMOND : SIX DIAMOND : SEVEN DIAMOND : EIGHT DIAMOND : NINE DIAMOND : TEN DIAMOND : JACK DIAMOND : QUEEN DIAMOND : KING HEART : ACE HEART : DEUCE HEART : THREE HEART : FOUR HEART : FIVE HEART : SIX HEART : SEVEN HEART : EIGHT HEART : NINE HEART : TEN HEART : JACK HEART : QUEEN HEART : KING SPADE : ACE SPADE : DEUCE SPADE : THREE SPADE : FOUR SPADE : FIVE SPADE : SIX SPADE : SEVEN SPADE : EIGHT SPADE : NINE SPADE : TEN SPADE : JACK SPADE : QUEEN SPADE : KING
CLUB : ACE CLUB : DEUCE CLUB : THREE CLUB : FOUR CLUB : FIVE CLUB : SIX CLUB : SEVEN CLUB : EIGHT CLUB : NINE CLUB : TEN CLUB : JACK CLUB : QUEEN CLUB : KING DIAMOND : ACE DIAMOND : DEUCE DIAMOND : THREE DIAMOND : FOUR DIAMOND : FIVE DIAMOND : SIX DIAMOND : SEVEN DIAMOND : EIGHT DIAMOND : NINE DIAMOND : TEN DIAMOND : JACK DIAMOND : QUEEN DIAMOND : KING HEART : ACE HEART : DEUCE HEART : THREE HEART : FOUR HEART : FIVE HEART : SIX HEART : SEVEN HEART : EIGHT HEART : NINE HEART : TEN HEART : JACK HEART : QUEEN HEART : KING SPADE : ACE SPADE : DEUCE SPADE : THREE SPADE : FOUR SPADE : FIVE SPADE : SIX SPADE : SEVEN SPADE : EIGHT SPADE : NINE SPADE : TEN SPADE : JACK SPADE : QUEEN SPADE : KING
ONE ONE TWO TWO THREE THREE FOUR FOUR FIVE FIVE SIX SIX *************************** ONE ONE ONE TWO ONE THREE ONE FOUR ONE FIVE ONE SIX TWO ONE TWO TWO TWO THREE TWO FOUR TWO FIVE TWO SIX THREE ONE THREE TWO THREE THREE THREE FOUR THREE FIVE THREE SIX FOUR ONE FOUR TWO FOUR THREE FOUR FOUR FOUR FIVE FOUR SIX FIVE ONE FIVE TWO FIVE THREE FIVE FOUR FIVE FIVE FIVE SIX SIX ONE SIX TWO SIX THREE SIX FOUR SIX FIVE SIX SIX