title: Android ArrayList<Object> filtering by current date
body: <p>Hello masters of Android &amp; Java :) I've spent about 5 hours today trying to find out how to filter my <code>ArrayList&lt;WeekViewEvent&gt;</code> (I'm using Alamkanak's WeekView external library) so my layout with custom arrayadapter can display events that match today's date (only monday events on Monday 5th Feb, tuesday events on Tuesday 6th Feb and so on...).</p>
  
  <p>This is how I create my <code>WeekViewEvent</code>'s ArrayList:</p>
  
  <pre><code>List&lt;WeekViewEvent&gt; newEvents = new ArrayList&lt;WeekViewEvent&gt;();
  
      Calendar startTime = Calendar.getInstance();
      startTime.set(Calendar.HOUR_OF_DAY, 12);
      startTime.set(Calendar.MINUTE, 0);
      startTime.set(Calendar.MONTH, 1);
      startTime.set(Calendar.YEAR, 2018);
  
      Calendar endTime = (Calendar) startTime.clone();
      endTime.add(Calendar.HOUR, 13);
      endTime.set(Calendar.MINUTE, 0);
      endTime.set(Calendar.MONTH, 1);
      endTime.set(Calendar.YEAR, 2018);
  
      WeekViewEvent event = new WeekViewEvent(7777, "All lucky 7's, startTime, endTime);
      event.setColor(R.color.event_color_01);
  
      newEvents.add(event);
  </code></pre>
  
  <p>and then the list is passed on to the adapter:</p>
  
  <pre><code>Adapter adapterevent = new Adapter(this, events);
      ListView listView = (ListView) findViewById(R.id.harmonogram_list_view);
      listView.setAdapter(adapterevent);
  </code></pre>
  
  <p>Is it even possible to "filter" the events by date ? Been reading some other posts, but to tell the truth the only operations I performed with ArrayList's were limited to adding, removing or gettin lenght of the array... </p>
  
  <p>What I'm thinking about is filtering events by looping and searching for start and end date and then creating new ArrayList like:</p>
  
  <pre><code>ArrayList&lt;WeekViewEvent&gt; filteredEvents = new ArrayList&lt;&gt;();
  for (WeekviewEvent event : NewEvents) {
      if(event.getStartTime().getTimeInMillis() &gt;= start of the current day &amp;&amp; event.getEndTime().getTimeInMillis &lt;= end of the current day
      events.add(event);
      }
  }
  return filteredEvents;
  </code></pre>
  
  <p>but I'm not sure if this is the right way to follow and if so - how to write rest of the code to grab only selected events. </p>
  
  <p>Any help would be greatly appreciated! Thank you in advance, Matt :)</p>