loop through a list of objects and match a field with enum code example
Example: java loop through enum
for (Direction dir : Direction.values()) {
// do what you want
}
for (Direction dir : Direction.values()) {
// do what you want
}