mirror of
https://github.com/Dichgrem/Java.git
synced 2025-12-16 12:41:58 -05:00
22 lines
456 B
Java
22 lines
456 B
Java
package com.study.demo4;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
class HomeController {
|
|
private List<SmartDevice> devices = new ArrayList<>();
|
|
|
|
public void addDevice(SmartDevice device) {
|
|
devices.add(device);
|
|
}
|
|
|
|
public String getDeviceStatus(String name) {
|
|
for (SmartDevice device : devices) {
|
|
if (device.getStatus().contains(name)) {
|
|
return device.getStatus();
|
|
}
|
|
}
|
|
return "Device not found";
|
|
}
|
|
}
|