Skip to content

Commit a7deef0

Browse files
committed
Changes to fortunes.
Signed-off-by: Santiago Pericas-Geertsen <[email protected]>
1 parent 0c959df commit a7deef0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

frameworks/Java/helidon/nima/src/main/java/io/helidon/benchmark/nima/models/Fortune.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
package io.helidon.benchmark.nima.models;
33

4-
public final class Fortune {
4+
public final class Fortune implements Comparable<Fortune> {
55
public int id;
66
public String message;
77

@@ -17,4 +17,8 @@ public int getId() {
1717
public String getMessage() {
1818
return message;
1919
}
20+
@Override
21+
public int compareTo(Fortune other) {
22+
return message.compareTo(other.message);
23+
}
2024
}

frameworks/Java/helidon/nima/src/main/java/io/helidon/benchmark/nima/services/FortuneHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
package io.helidon.benchmark.nima.services;
33

4-
import java.util.Comparator;
4+
import java.util.Collections;
55
import java.util.List;
66

77
import com.fizzed.rocker.runtime.ArrayOfByteArraysOutput;
@@ -32,7 +32,7 @@ public void handle(ServerRequest req, ServerResponse res) {
3232
res.header(CONTENT_TYPE_HTML);
3333
List<Fortune> fortuneList = repository.getFortunes();
3434
fortuneList.add(ADDITIONAL_FORTUNE);
35-
fortuneList.sort(Comparator.comparing(Fortune::getMessage));
35+
Collections.sort(fortuneList);
3636
res.send(fortunes.template(fortuneList)
3737
.render(ArrayOfByteArraysOutput.FACTORY)
3838
.toByteArray());

0 commit comments

Comments
 (0)