title: Is Realm's .where faster than filtering a list manually?
body: <p>I am creating a project using a realm database.</p>
  
  <p>I also have a lot of lists which I wish to filter while the user types.</p>
  
  <p>The biggest one of them will probably be the list of customers</p>
  
  <p>Currently I am using realm by using a wrapper class for each object (if anyone has a better suggestion I'm definitely open to it)</p>
  
  <p>The objects I am using are like this:</p>
  
  <pre><code>public class Customer_Realm extends RealmObject{
      private int _id;
      private String _name; //...etc
  
      public int get_id(){ return _id; }
      public void set_id(int id) { _id = id;}
      //etc
  }
  
  
  Public class Customer() {
      Customer_Realm _base;
      public Customer(Customer_Realm base) { _base = base;}
      public int get_id(){ return _base.get_id(); }
      public void set_id(int id) { _base.set_id(id);}
      //...etc
  }
  </code></pre>
  
  <p>Along with this I have an ArrayListAdapter for customer objects. My question is, would this:</p>
  
  <pre><code>public class CustomerAdapter extends ArrayListAdapter&lt;Customer&gt; {
     List&lt;Customer&gt; _customers;
     String _filter = null;
  
     public void set_filter(string name) {
        _filter = name;
        notifyDataSetChanged();
     }
  
     @override 
     public int getCount(){
        return get_visible().count();
     }
  
     public Customer getItem(int position){
        return get_visible().get(position);
     }
  
     public List&lt;Customer&gt; get_visible() {
        if (_filter == null)
           return _customers;
        List&lt;Customer&gt; visible = new ArrayList&lt;Customer&gt; ();
        foreach (Customer c : _customers){
           if (c.get_name().contains(_filter)
              visible.add(c);
        }
        return visible;
     }
  }
  </code></pre>
  
  <p>Or would this be better?</p>
  
  <pre><code>public class CustomerAdapter extends ArrayListAdapter&lt;Customer&gt; {
     Realm _database;
     String _filter = null;
  
     public void set_filter(string name) {
        _filter = name;
        notifyDataSetChanged();
     }
  
     @override 
     public int getCount(){
        return get_visible().count();
     }
  
     public Customer getItem(int position){
        return get_visible().get(position);
     }
  
     public List&lt;Customer&gt; get_visible() {
        RealmResults&lt;Customer_Realm&gt; result = null;
        if (_filter == null)
           result = _database.allObjects(Customer_Realm.class);
        else
           result = _database.where(Customer_realm.class).contains("_name",_filter);
  
        List&lt;Customer&gt; visible = new ArrayList&lt;Customer&gt; ();
        foreach (Customer_Realm c : result){
           visible.add(new Customer(c));
        }
        return visible;
     }
  }
  </code></pre>
  
  <p>Unfortunately my database contains only a small sample of data(and realm for windows does not have an editor so I can enter data manually) so  when I try either implementation I do not see any difference, I was wondering if anyone has any experience with what happens when you use such an implementation with a large number of data</p>
  
  <p>Thanks in advance for any help you can provide</p>