title: Implementing a Deck of Cards in Java
body: <p>So I have a lab (we are allowed to seek outside help on it, so here I am after lots of head scratching) where we have to implement a deck of cards.  We have to use the enum class to create num</p>
  
  <p>For Suits:</p>
  
  <pre><code>public enum Suits {
  CLUBS, HEARTS, DIAMONDS, SPADES
  </code></pre>
  
  <p>}</p>
  
  <p>For Numerals:</p>
  
  <pre><code>public enum Numerals {
  DEUCE(2), THREE(3), FOUR(4), FIVE(5), SIX(6), SEVEN(7), EIGHT(8), NINE(9), 
  TEN(10), JACK(11), QUEEN(12), KING(13), ACE(14);
  </code></pre>
  
  <p>}</p>
  
  <p>My card class is pretty straightforward, but I'm not sure about these two blocks of code:</p>
  
  <pre><code>    public int compareTo (Card aCard){
      if (aCard.aNumeral.equals(this.aNumeral) &amp;&amp; aCard.aSuit.equals(this.aSuit)){
          return 0;
      }
      else {
          return -1;
      }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    public boolean equals (Card aCard){
      if (this.compareTo(aCard) == 0){
          return true;
      }
      else {
          return false;
      }
  }
  </code></pre>
  
  <p>Now for the tricky part...the Deck...</p>
  
  <p>So we have to implement the deck using Cloneable, Iterable and Comparator, so here is what I have so far and just can't figure out what to.</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Comparator;
  import java.util.Iterator;
  
  public class Deck implements Cloneable, Iterable&lt;Card&gt;, Comparator&lt;Card&gt; {
  
  private ArrayList&lt;Card&gt; cards;
  
  public Deck (){
      for (Card c : cards){
  
  
      }
  
  }
  </code></pre>
  
  <p>I'm struggling to even put together the constructor.  I'm planning on using an ArrayList to essentially "hold" 52 sorted cards (as you can see); but we have to ultimately return a sorted deck.  Any suggestions on where to go?</p>