title: How to sort and filter a string-array?
body: <p>I want to sort a list of items in a string-array and then filter them using a <code>SearchView</code> in the toolbar.</p>
  
  <p>This is the string-array (each item is the name of a png drawable in res folder):</p>
  
  <pre><code>&lt;string-array name="brands"&gt;
      &lt;item&gt;facebook&lt;/item&gt;
      &lt;item&gt;twitter&lt;/item&gt;
      &lt;item&gt;instagram&lt;/item&gt;
      &lt;item&gt;android&lt;/item&gt;
      &lt;item&gt;blackberry&lt;/item&gt;
      &lt;item&gt;samsung&lt;/item&gt;
      &lt;item&gt;huawei&lt;/item&gt;
      &lt;item&gt;starbucks&lt;/item&gt;
      &lt;item&gt;motorola&lt;/item&gt;
      &lt;item&gt;nexus&lt;/item&gt;
      &lt;item&gt;lg&lt;/item&gt;
      &lt;item&gt;beats&lt;/item&gt;
      &lt;item&gt;sony&lt;/item&gt;
      &lt;item&gt;lenovo&lt;/item&gt;
      &lt;item&gt;dell&lt;/item&gt;
      &lt;item&gt;hp&lt;/item&gt;
  &lt;/string-array&gt;
  </code></pre>
  
  <p>In a <code>RecyclerView</code> Adapter, I have set the array and an <code>ArrayList</code>:</p>
  
  <pre><code>private String[] brands;
  private ArrayList&lt;Integer&gt; drawables;
  </code></pre>
  
  <p>And I have a function that adds the id of the drawables from the <code>string-array</code> to the <code>ArrayList</code> so I can later load the drawable by simply writing <code>drawables.get(position);</code>  :</p>
  
  <pre><code>private void loadLogo() {
      drawables = new ArrayList&lt;&gt;();
  
      brands = context.getResources().getStringArray(R.array.brands);
  
      for (String extra : brands) {
          int res = context.getResources().getIdentifier(extra, "drawable", context.getPackageName());
          if (res != 0) {
              final int brandInt = context.getResources().getIdentifier(extra, "drawable", context.getPackageName());
              if (brandInt != 0)
                  drawables.add(brandInt);
          }
      }
  }
  </code></pre>
  
  <p>What I want to know is:</p>
  
  <ol>
  <li>How to sort <code>brands</code> before adding items to <code>drawables</code>.</li>
  <li>How to create a filter function to filter <code>brands</code> and make the content change in the <code>RecylerView</code> properly.</li>
  </ol>
  
  <p>I hope someone can help me. Thanks in advance.</p>