title: How can I ignore a certain value when sorting so it always appears at the bottom of the sorted list
body: <p>I have a list of items, each item has a price field. some items have price equal to 999. When sorting, I want the elements that have price == 999 to always be at the bottom of the list, whether the sort direction is ascending or descending.</p>
  
  <p>I have tired the the code below and it works for sorting low to high (ascending) but not when descending.</p>
  
  <pre><code>Collections.sort(itemList, new Comparator&lt;Item&gt;() {
      @Override
      public int compare(Item o1, Item o2) {
          if(sort == 4){ // Low to High
              return Double.compare(o1.getPrice(), o2.getPrice());
          }else{ // High to Low
              return Double.compare(o2.getPrice(), o1.getPrice());
  
          }
      }
  });
  </code></pre>