I am trying to solve a question that provided the following classes to me. How can I create a custom iterator class DeckIterator
that will help me iterate the Card[] deck
array in the Deck class?
I have a Card class that looks like this:
public class Card {
private char suit;
private int value;
public Card (char s, int v)
{
this.suit = s;
this.value = v;
}
}
And I have a Deck class that looks like this:
public class Deck {
private Card[] deck;
private int idx;
public Deck (int size)
{
this.deck = new Card[size];
this.idx = 0;
}
}
Thanks a lot