Sha256: 252d37fa37a1a3944bb6b3d2c9a742a3b03d16f35284107784ed7ee5d0ebf490
Contents?: true
Size: 525 Bytes
Versions: 57
Compression:
Stored size: 525 Bytes
Contents
import java.util.EnumSet; import java.util.List; import java.util.stream.Collectors; public class Allergies { private int score; public Allergies(int score) { this.score = score; } public List<Allergen> getList() { return EnumSet.allOf(Allergen.class).stream() .filter(this::isAllergicTo) .collect(Collectors.toList()); } public boolean isAllergicTo(Allergen allergen) { return (score & allergen.getScore()) == allergen.getScore(); } }
Version data entries
57 entries across 57 versions & 1 rubygems