diff --git a/src/main/java/cokr/xit/foundation/web/RequestHandlerReader.java b/src/main/java/cokr/xit/foundation/web/RequestHandlerReader.java index 381e9e7..f0eccad 100644 --- a/src/main/java/cokr/xit/foundation/web/RequestHandlerReader.java +++ b/src/main/java/cokr/xit/foundation/web/RequestHandlerReader.java @@ -1,9 +1,9 @@ package cokr.xit.foundation.web; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.stream.Collectors; import org.springframework.web.method.HandlerMethod; @@ -42,13 +42,13 @@ public class RequestHandlerReader extends AbstractComponent { } }); - Set parentIDs = nameURLs.stream() + nameURLs.stream() .filter(row -> !isEmpty(row.get("parentID"))) .map(row -> row.string("parentID")) - .collect(Collectors.toSet()); - parentIDs.forEach(parentID -> { - nameURLs.add(menuItem(null, parentID)); - }); + .collect(Collectors.toSet()) + .forEach(parentID -> { + nameURLs.add(menuItem(null, parentID)); + }); Hierarchy tree = new HierarchyBuilder() .getID(row -> row.string("url")) @@ -62,7 +62,10 @@ public class RequestHandlerReader extends AbstractComponent { }) .setElements(nameURLs) .build(); - return tree.topElements(); + + List top = tree.topElements(); + Collections.sort(top, (u0, u1) -> u0.string("url").compareTo(u1.string("url"))); + return top; } private static DataObject menuItem(String name, String path) {