title: java.util.EmptyStackException
body: <p>I have the following part of code to initialize an array of stack:</p>
  
  <pre><code>vDec.setRoute(new Stack[vDec.getIndexes().length]);
  for(i=0;i&lt;vDec.getIndexes().length;i++){
      vDec.getRoute()[i]=new Stack&lt;&gt;();
  }
  </code></pre>
  
  <p>I get <code>java.util.EmptyStackException</code> when I am checking if it is empty inside a <code>while</code> loop but not before it. So for this part:</p>
  
  <pre><code>if(vDec.getRoute()[(int)IndexVeh.peek()].isEmpty()){
      System.out.println("it works");
  }
  while((cDec.getVisitedBy()[crtCust]==-1)&amp;&amp;(!Distance.empty())){
      if(vDec.getRoute()[(int)IndexVeh.peek()].isEmpty()){
          do something
  </code></pre>
  
  <p>I first get as output <code>it works</code> and then the exception.</p>