Here's my code
The problem is, on the first if, else statement it seems like my method is completely ignoring it. I tried to test it by printing some guff in both the if and else and I got nothing back, but check is always true no matter what. catalogItems is an <CatalogItem>ArrayList and the CatalogItem object is (int, String, double) if that helps.public void add(int newID, String newDesc, double newCost) { catalogItems.trimToSize(); CatalogItem copy = new CatalogItem(newID, newDesc, newCost); for(int i = 0; i < catalogItems.size();) if(catalogItems.get(i).getItemID() == newID) { i = catalogItems.size(); check = true; } else { i++; check = false; } if(check = true) System.err.println("Error, that item ID already exists."); else catalogItems.add(copy); }