Skip to content

Commit

Permalink
Change RoutesBuilder to use LinkedHashMap (preserve order of added ro…
Browse files Browse the repository at this point in the history
…utes?)

Effectively replacing EnumMap with LinkedHashMap as we need to preserve the order of routes that are added.
  • Loading branch information
rbygrave committed Dec 2, 2024
1 parent 4249441 commit 05bedc7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.avaje.jex.routes;

import java.util.EnumMap;
import java.util.LinkedHashMap;
import java.util.List;

import io.avaje.jex.HttpFilter;
Expand All @@ -14,7 +15,7 @@ public final class RoutesBuilder {

public RoutesBuilder(Routing routing, boolean ignoreTrailingSlashes) {
this.ignoreTrailingSlashes = ignoreTrailingSlashes;
final var buildMap = new EnumMap<Routing.Type, RouteIndexBuild>(Routing.Type.class);
final var buildMap = new LinkedHashMap<Routing.Type, RouteIndexBuild>();
for (var handler : routing.handlers()) {
buildMap.computeIfAbsent(handler.getType(), h -> new RouteIndexBuild()).add(convert(handler));
}
Expand Down

0 comments on commit 05bedc7

Please sign in to comment.