From 212f8d0172b6a5282b8f56c4b6454efc9595bc92 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Tue, 22 Aug 2023 16:03:19 +0900 Subject: [PATCH] =?UTF-8?q?url=20=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../foundation/web/RequestHandlerReader.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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) {