@Override public boolean test(Substation substation) { Objects.requireNonNull(substation); return substation.getVoltageLevelStream() .anyMatch(this::test); }
/** * Keep this substation if the IDs list contains the ID of this substation or one of its voltage levels. * @param substation The substation to test * @return true if the IDs list contains the ID of this substation or one of its voltage levels, false otherwise */ @Override public boolean test(Substation substation) { Objects.requireNonNull(substation); if (ids.contains(substation.getId())) { return true; } return substation.getVoltageLevelStream() .map(VoltageLevel::getId) .anyMatch(ids::contains); }