16. Predicates and Other Functional Interfaces
Activity 1: Toggling the Sensor States
Solution
Activity1.java
52 for (Sensor sensor : sensors) { 53 if (hasAlarmOrWarning.test(sensor)) { 54 alarmOrWarning = true; 55 } 56 } 57 58 if (alarmOrWarning) { 59 System.out.println("Alarm, or warning, was triggered!"); 60 61 62 for (Sensor sensor : sensors) { 63 &...