title: How do you check if a list contains an element that matches some predicate?
body: <p>I have an ArrayList containing objects which have 4 parameters (x, y, iD and myType). I want to verify if there are objects in this ArrayList which have particular coordinates, independently of their iD and myType parameters. 
  I wanted to use <code>Arrays.asList(yourArray).contains(yourValue)</code> but it is when the object has only one parameter.</p>
  
  <p>Here is the whole code: </p>
  
  <pre><code>public class MyObject {
  
    public float x;
    public float y;
    public int iD;
    public String myType;
  
  
    public MyObject (float x, float y, int iD, String myType) 
    {
      this.myType = myType;
      this.iD = iD;
      this.x = x;
      this.y = y;
    }
    @Override
      public String toString() {
      return ("[iD="+iD+" x="+x+" y="+y +" type="+myType+"]");
    }
  }
  
  
  ArrayList&lt;MyObject&gt; myArrayList = new ArrayList&lt;MyObject&gt;();
  
  void setup() 
  {
    size(100, 60);
    myArrayList.add(new MyObject(3.5, 4.5, 6, "a"));
    myArrayList.add(new MyObject(5.4, 2.6, 4, "b"));
  }
  </code></pre>
  
  <p>For example, if I want to verify if there is an object which has the coordinates (3.5, 4.5), how should I proceed ?
  Is there an easy way to do this ?</p>
  
  <p>thanks for your help</p>