title: java File sorting order in windows and linux difference
body: <p>I have a folder in windows/Linux which has below files</p>
  
  <pre><code>test_1a.play
  test_1AA.play
  test_1aaa.play
  test-_1AAAA.play
  </code></pre>
  
  <p>I am reading files and and storing it But windows and linux gives different order. As my application runs in both platform I need consistent order(Linux order). Any suggestion for fixing this.</p>
  
  <pre><code>File root = new File( path );
  File[] list = root.listFiles();
  list&lt;File&gt; listofFiles = new ArrayList&lt;File&gt;();
  .....
  for ( File f : list ) {
  
  
  ...
  read and store file in listofFiles
  ...
  }
  Collections.sort(listofFiles);
  </code></pre>
  
  <p><strong>Windows gives me below order</strong></p>
  
  <pre><code>test-_1AAAA.play
  test_1a.play
  test_1AA.play
  test_1aaa.play
  </code></pre>
  
  <p><strong>Linux gives me below order</strong></p>
  
  <pre><code>test-_1AAAA.play
  test_1AA.play
  test_1a.play
  test_1aaa.play
  </code></pre>