public boolean isEmpty()
{
return size() == 0;
}
public int size()
{
return cards.size();
}
public void add(int card) throws IllegalStateException
{
if(CARDS_IN_DECK == size())
throw new IllegalStateException("Cannot add more than 52 cards");
cards.add(new Integer(card));
}
public int top()
{
return ((Integer) cards.get(0)).intValue();
}
public void remove()
{
cards.remove(0);
}
}
文章来源于领测软件测试网 https://www.ltesting.net/