title: How to set filter for recycler view if search query resulting no match in search view
body: <p>This code works fine if the item we entered in search view matches but if we enter some query which does not match ...application is crashing in android.</p>
  
  <p>Here Main_ATMItemList is the list in which whole list of results are returned.
  Please help me what I need to add so that the code works even the query does not match.</p>
  
  <p>I have created this method in adapter class</p>
  
  <pre><code>public void setFilter(String queryText) {
          visibleObjects = new ArrayList&lt;&gt;();
  
              for (RouteByATMList.Route_ATM item : Main_ATMItemList) {
                  if (item.ATMNumber.startsWith(queryText))
                  {
                      visibleObjects.add(item);
  
                  }
              }
          }
  
          notifyDataSetChanged();
          Log.e("dataset changed","dataset changed");
      }
  </code></pre>