private static <P, T> List<T> visitTasks(Visitor<P, T> visitor, ProjectAndTaskFilter filter, ProjectView project,
P userProjectObject) {
List<T> taskObjects = new ArrayList<T>();
Iterator<TaskView> iterator = project.getTasks().iterator();
while (iterator.hasNext()) {
TaskView task = iterator.next();
if (filter.doesAllowTask(task)) {
T taskObject = visitor.visitTask(task, project, userProjectObject);
taskObjects.add(taskObject);
}