title: Custom Sort Groovy JSONArray - Custom Values First, Then Alphabetical
body: <p>I have a static list of values that is in a JSONArray. Here is my example array:</p>
  
  <pre><code>JSONArray json = new JSONArray()
  
  json = ["B", "E", "C", "Z", "A", "X", "F", "H"]
  </code></pre>
  
  <p>I need to sort this json array in a custom way. I need to put "E" first, "F" second, and then sort the rest by alphabetical order. </p>
  
  <p>I want my end result to be this:</p>
  
  <pre><code>json = ["E", "F", "A", "B", "C", "H", X", "Z"]
  </code></pre>
  
  <p>Groovy has the basic sort functionality that I can sort alphabetically or reverse alphabetically using:</p>
  
  <pre><code>json.sort()
  </code></pre>
  
  <p>or</p>
  
  <pre><code>json.reverse()
  </code></pre>
  
  <p>I'm looking for an easy way to do a custom sort.</p>