title: Java ArrayList starts with 1 not 0?
body: <p>I'm retrieving some data from <code>DB</code> with the <code>ff</code> code:</p>
  
  <pre><code>List&lt;modelA&gt; list= new ArrayList&lt;modelA&gt;();
  list = modelA.getList(parameter);
  </code></pre>
  
  <p>This is what has been retrieved:</p>
  
  <pre><code>list[1] = "var1"
  
  list[2] = "var2"
  
  list[3] = "var3"
  </code></pre>
  
  <p><code>list.size() = 3</code> and <code>list[0]</code> does not exist.</p>
  
  <p>I transferred the list to a LinkedHashSet to set the indexes right, but it doesn't work. The list is still the same.</p>
  
  <pre><code>Set&lt;modelA&gt; hs = new LinkedHashSet&lt;&gt;();
  hs.addAll(list);
  list.clear();
  list.addAll(hs);
  </code></pre>
  
  <p>Is there a way to fix the indexes so that it will start with 0 and not 1?</p>
  
  <p>This is the error when I run <code>list.get(0)</code></p>
  
  <pre><code>java.lang.NullPointerException
      at applicationmodels.f08.pv.F08PV008Model.search(F08PV008Model.java:221)
      at controllers.f08.pv.F08PV008.control(F08PV008.java:148)
      at Routes$$anonfun$routes$1$$anonfun$applyOrElse$99$$anonfun$apply$99.apply(routes_routing.scala:1510)
      at Routes$$anonfun$routes$1$$anonfun$applyOrElse$99$$anonfun$apply$99.apply(routes_routing.scala:1510)
      at play.core.Router$HandlerInvoker$$anon$7$$anon$2.invocation(Router.scala:183)
      at play.core.Router$Routes$$anon$1.invocation(Router.scala:377)
      at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:56)
      at play.db.jpa.TransactionalAction$1.apply(TransactionalAction.java:20)
      at play.db.jpa.TransactionalAction$1.apply(TransactionalAction.java:18)
      at play.db.jpa.JPA.withTransactionAsync(JPA.java:177)
      at play.db.jpa.TransactionalAction.call(TransactionalAction.java:15)
      at play.core.j.JavaAction$$anon$3.apply(JavaAction.scala:91)
      at play.core.j.JavaAction$$anon$3.apply(JavaAction.scala:90)
      at play.core.j.FPromiseHelper$$anonfun$flatMap$1.apply(FPromiseHelper.scala:82)
      at play.core.j.FPromiseHelper$$anonfun$flatMap$1.apply(FPromiseHelper.scala:82)
      at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
      at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:249)
      at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
      at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:37)
      at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:42)
      at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)
      at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
      at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
      at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
      at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
  </code></pre>