Skip to content

Commit a587d50

Browse files
committed
Sort the docs method result by classes and methods
1 parent 6e6f5d8 commit a587d50

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/java/org/javacord/bot/commands/DocsCommand.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,12 @@ private void populateMethods(DiscordApi api, EmbedBuilder embed, String searchSt
128128

129129
int totalTextCount = 25; // the maximum tracker string length
130130
List<Map.Entry<String, List<JavadocMethod>>> entries = new ArrayList<>(methodsByClass.entrySet());
131+
entries.sort(Comparator.comparing(Map.Entry::getKey, String::compareToIgnoreCase));
131132
int classesAmount = entries.size();
132133
for (int classIndex = 0; classIndex < classesAmount; classIndex++) {
133134
Map.Entry<String, List<JavadocMethod>> entry = entries.get(classIndex);
134135
List<JavadocMethod> methods = entry.getValue();
136+
methods.sort(Comparator.comparing(JavadocMethod::getShortenedName, String::compareToIgnoreCase));
135137
StringBuilder methodsBuilder = new StringBuilder();
136138
int methodsAmount = methods.size();
137139
for (int methodIndex = 0; methodIndex < methodsAmount; methodIndex++) {

0 commit comments

Comments
 (0)