List<ExternalSystemTask> (@NotNull ProjectSystemId projectSystemId, ExternalSystemTaskState @NotNull ... taskStates) { List<ExternalSystemTask> result = new SmartList<>(); for (ExternalSystemTask task : myTasksDetails.values()) { if (task instanceof AbstractExternalSystemTask externalSystemTask) { if (externalSystemTask.getExternalSystemId().getId().equals(projectSystemId.getId()) && ArrayUtil.contains(externalSystemTask.getState(), taskStates)) { result.add(task); } } } return result; }