package sagan.questions.support;

import sagan.projects.Project;
import sagan.projects.support.ProjectMetadataService;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
class QuestionsController {

    private ProjectMetadataService service;

    @Autowired
    public QuestionsController(ProjectMetadataService service) {
        this.service = service;
    }

    @RequestMapping("/questions")
    public String show(Model model) {

        model.addAttribute("projects", projectsWithStackOverflowTags());
        return "questions/index";
    }

    private List<Project> projectsWithStackOverflowTags() {
        return service.getProjects().stream()
                .filter(project -> !project.getCategory().equals("attic"))
                .filter(project -> !project.getStackOverflowTagList().isEmpty())
                .sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName()))
                .collect(Collectors.toList());
    }
}

@@ -31,39 +31,8 @@
 t;%0A%0A
-import sagan.projects.Project;%0A
 impo
@@ -86,31 +86,8 @@
 e;%0A%0A
-import java.util.List;%0A
 impo
@@ -653,158 +653,8 @@
 ts%22,
- projectsWithStackOverflowTags());%0A        return %22questions/index%22;%0A    %7D%0A%0A    private List%3CProject%3E projectsWithStackOverflowTags() %7B%0A        return
  ser
@@ -966,18 +966,53 @@
 oList())
+);%0A        return %22questions/index%22
 ;%0A    %7D%0A
 %7D%0A
@@ -1009,10 +1009,11 @@
 ;%0A    %7D%0A
+%0A
 %7D%0A

Simplify QuestionsController