I have a custom array list with almost 600 entries. 

I need to filter some value based on some condition. I try basic loop stuff but its very time taking process, what I want is the fastest way to filter the data.

```
public class MyModel {
  private boolean attempeted = false;
  private String answer;

  public MyModel(String answer) {
    this.answer = answer;
  }

  public void setAttempted(boolean attempeted) {
    this.attempeted = attempeted;
  }

  public String getAnswer() {
    return answer;
  }

  public boolean isAttempeted() {
    return attempeted;
  }

}

```

The above is my model what I want is I need to get only data having **attempted value true**. This is what I have:

```
ArrayList<TestAnswerModel>myMainArrayList=array which contain all my data
ArrayList<TestAnswerModel>filterArrayList=new ArrayList<>();
for(int i=0;i<myMainArrayList.size();i++)
    {
        if(myMainArrayList.get(i).isAttempeted()) {
            filterArrayList.add(myMainArrayList.get(i))
        }
    }

```

The above is working fine but if my data is too large it takes a lot of time. Also some times the data will be 600 and the attempted value only true for 2 or 3 values so this looping will happen without any result.

What I want any fastest method to filter the data.