title: Java Vector & ArrayindexoutofBoundsException
body: <p>Hello fellow developers!
  I have this method for my java program below. It has 52 cards(vector v) that get shuffled and it should only print the ones that do not have a card with the same symbol following them( so if its Q of hearts then King of hearts it should skip King of hearts)
  its working as it should be but i get: </p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:
    Array index out of range: 52 at java.util.Vector.get(Vector.java:748)
    at cardgame.Cardgame.shufflenosamebefore(Cardgame.java:507)</p>
  </blockquote>
  
  <p>(507 is this line  <code>if (v.get(i).getsymbol() != v.get(i + 1).getsymbol()) {</code>)</p>
  
  <pre><code> public void shufflenosamebefore() {
      Collections.shuffle(v);
      for (i = 0; i &lt; v.size(); i++) {
          if (v.get(i).getsymbol() != v.get(i + 1).getsymbol()) {
  
              if (v.get(i).getsymbol() == 'T') {
                  v.get(i).setsymbol('♣');
              }
  
              if (v.get(i).getsymbol() == 'P') {
                  v.get(i).setsymbol('♠');
              }
  
              if (v.get(i).getsymbol() == 'C') {
                  v.get(i).setsymbol('♦');
              }
  
              if (v.get(i).getsymbol() == 'H') {
                  v.get(i).setsymbol('♥');
              }
  
              if (v.get(i).getnumber() == 11) {
                  System.out.println("Card n." + (i + 1) + " is J " + v.get(i).getsymbol());
              } else if (v.get(i).getnumber() == 12) {
                  System.out.println("Card n." + (i + 1) + " is Q " + v.get(i).getsymbol());
              } else if (v.get(i).getnumber() == 13) {
                  System.out.println("Card n." + (i + 1) + " is K " + v.get(i).getsymbol());
              } else if (v.get(i).getnumber() == 0 || v.get(i).getnumber() == 1) {
                  System.out.println("Card n." + (i + 1) + " is A " + v.get(i).getsymbol());
              } else {
                  System.out.println("Card n." + (i + 1) + " is " + v.get(i).getnumber() + " " + v.get(i).getsymbol());
              }
          }
      }
  }
  </code></pre>
  
  <p>Any input of why its giving me this error and the build fails? Thanks a lot!</p>