AntBuildTarget[] (final AntBuildFile buildFile) { final List<ExecutionEvent> events = getEventsByClass(); if (events.isEmpty()) { return AntBuildTargetBase.EMPTY_ARRAY; } return events.stream().map(event -> (MetaTarget)getTargetForEvent(event)) .filter(target -> target != null && buildFile.equals(target.getBuildFile())).toArray(AntBuildTarget[]::new); }