title: Java Collection value locator
body: <p>i'm currently creating a GUI that uses the list collection. My problem is with the validation function.</p>
  
  <pre><code>public void idValidate(int id) {
      for (Item i : items) {
          if (i.getId() == id) {
              checker = true;
          } else {
              checker = false;
          }
      }
  
  }
  </code></pre>
  
  <p>Here's a sample of where I use this function.</p>
  
  <pre><code>private void checkEditBtnActionPerformed(java.awt.event.ActionEvent evt) {                                             
      int id = Integer.parseInt(idEditTxt.getText());
      idValidate(id);
      System.out.println(checker);
      if (checker == true) {
          nameEditTxt.setEditable(true);
          priceEditTxt.setEditable(true);
          descEditTxt.setEditable(true);
          updateEditBtn.setEnabled(true);
      } else {
          JOptionPane.showMessageDialog(myJFrame.this, "ID not found!", "Validation Message", JOptionPane.WARNING_MESSAGE);
      }
  </code></pre>
  
  <p>When I input 2 or more lists, the only ones that return true are the recently added ones. The checker does not return true if I try to locate the first item I input.</p>
  
  <p>Thank you :)</p>