title: Java Arraylist get method
body: <pre><code>import java.util.*;
  
  public class Deck {
      public int deckSize = 52;
      public ArrayList&lt;Card&gt; deck1 = new ArrayList&lt;Card&gt;(deckSize);
  
      public Deck() {
          for (CardEnum card : CardEnum.values()) {
              for (SuitEnum suit: SuitEnum.values()) {
                  Card newCard = new Card(card, suit);
                  this.deck1.add(newCard);
              }
          }
      }
  
      int size() { return this.deck1.size(); }
  
      String draw() {
          Iterator&lt;Card&gt; itrCard = deck1.iterator();
  
          if (!itrCard.hasNext()) {
              throw new IndexOutOfBoundsException("Deck is empty!");
          }
  
          Card next = itrCard.next();
          String name = next.getName();
          this.deck1.remove(next);
          return name;
      }
  
      void shuffle() {
          Collections.shuffle(this.deck1);
      }
  
      public static void main(String[] args) {
          Deck deck1 = new Deck();
          deck1.shuffle();
  
          System.out.println("The first five cards drawn are:");
          for (int i = 0; i&lt;5; i++) {
              System.out.print(deck1.draw() + " ");
          }
          System.out.println("\n");
          for (int i = 0; i&lt;5; i++) {
              System.out.print(deck1.draw() + " ");
          }
  
          System.out.println(deck1.get(1));
  
          System.out.println("\nHow many cards do you want to replace? (Max of 4)");
          Scanner in = new Scanner(System.in);
          int v;
          v = in.nextInt();
      }
      //System.out.println(deck2.get(4));
  }
  </code></pre>
  
  <p>For this segment of code it says the method get is undefined for the type Deck? How can I make the get method work? Also I am trying to be able to create a function to replace up to 4 of the cards. I can deal out old cards, but how can I keep the old ones. I also need to be able to evaluate the hand and tell what it is (full house, pair, etc). I am  finding this to be quite difficult, so even if you can only answer one of my questions, I would greatly appreciate it.</p>