title: iterating through list in java using for loop
body: <p>How does one iterate through a list datastructure using indices. For example consider a sentence in form a list with each element being a word. Can I step through each word using the index? Something like this -- </p>
  
  <pre><code>// sentence defined something like this - List&lt;String&gt;
  int size = sentence.size();
  for (int i=0; i&lt;size-1; i++)
  {
      System.out.println(sentence[i] + " " + sentence[i+1]);
  }
  </code></pre>
  
  <p>ofcourse the above code doesn't work but is it possible to do something on those lines? As you can see, I want to access the two consecutive elements and using iterators, it starts becoming really messy.</p>