I'm looping through an enum to find a certain value. If it finds it it continues the program. Else, it closes the program. My current algorithm is checking if all of the values are equal instead of continuing when one is equal. How do I make it continue if it finds one equal value.
public enum stuff{
//
apple("apple.png"),
banana("banana.png"),
spinach("spinach.png");
//
//Variables
private String Path;
//Constructor
Enemies (String path) {
Path = path;
}
public String getPath() {
return Path;
}
}
Actual loading done in another class
String stuffType = banana;
for (stuff s : stuff.values()) {
if(stuffType != s.name()){ //checks if any are a banana
System.exit(0);
}
}