Due to a ransomware attack, the wiki was reverted to a July 2022 version. . We apologize for the lack of a more recent valid backup.
...
- Classes that are intended to be instantiated as immutable objects (e.g.
DefaultDevice
) should have all class all variables declaredfinal
. Collections (
Sets
,Maps
, etc) returned by getters should be immutable, or a copy of the existing Collection.Code Block language java @Override public Iterable<Device> getDevices() { return Collections.unmodifiableCollection(devices.values()); } // or, if copying @Override public Set<DeviceId> getDevices(NodeId nodeId) { Set<DeviceId> ids = new HashSet<>(); for (Map.Entry<DeviceId, NodeId> d : masterMap.entrySet()) { if (d.getValue().equals(nodeId)) { ids.add(d.getKey()); } } return ids; }
...