Skip to content

Commit

Permalink
fix getOrAdd
Browse files Browse the repository at this point in the history
  • Loading branch information
duncpro committed Aug 15, 2022
1 parent 7073904 commit a41756f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
36 changes: 17 additions & 19 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "com.duncpro"
version = "1.0-SNAPSHOT-11"
version = "1.0-SNAPSHOT-12"

repositories {
mavenCentral()
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/duncpro/jroute/router/TreeRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public void add(Route route, E endpoint) throws RouteConflictException {
@Override
public E getOrAdd(Route route, Supplier<E> endpointFactory) {
final var node = findOrCreateNode(rootRoute, route);
if (node.getEndpoint().isPresent()) return node.getEndpoint().get();

final var endpoint = endpointFactory.get();
node.setEndpoint(endpoint);
return endpoint;
Expand Down

0 comments on commit a41756f

Please sign in to comment.