title: Enhance and remove redundant length check in while Loop
body: <p>I have a piece of code as below: </p>
  
  <pre><code> while ((line = reader.readNext()) != null) {
  
                  identityJmPojo.setIdentity(line[0]);
                  identityJmPojo.setJM(line.length  &gt; 1 ? line[1] : jsonValue);
  
                  identityJmList.add(identityJmPojo);
                  size = identityJmList.size();
  
                  switch (size) {
                      case STEP:
                          counter = counter + STEP;
                          payloadEngine.prepareJson(identityJmList, uploaderPoolService);
                          identityJmList.clear();
  
                          long stopTime = System.currentTimeMillis();
                          long elapsedTime = stopTime - startTime;
                          logger.info("=================== Time taken to read " + STEP + " records from CSV: " + elapsedTime + " and total records read: " + counter + "===================");
                          break;
                  }
  
              }
  </code></pre>
  
  <p>I am reading hundreds of billions of records from a CSV and the speed is business critical. </p>
  
  <p>now for the statement: </p>
  
  <pre><code>identityJmPojo.setJM(line.length  &gt; 1 ? line[1] : jsonValue);
  </code></pre>
  
  <p>The business defined consideration is if line.length is > 1 in the first iteration, it would be same for nth iteration and so I want to remove the redundant condition checking in every loop iteration. Just somehow set this for once and never use the ternary operator again. </p>
  
  <p>Any hints or head ons would be greatly appreciated. </p>