title: Count items in Arraylist that have specific attribute
body: <p>I want to execute code if NONE of the items in Arraylist have attribute 'slotted' set to false. I use the following code :</p>
  
  <pre><code>int p=0;
  
   for (int i = 0; i &lt; AppleList.size();i++){
       if (AppleList.get(i).slotted = true){
          p++;
       } 
  
  if (p == 0){
  
      //EXECUTE CODE
  
  }
  </code></pre>
  
  <p>Is there any way to do this better?</p>