File tree Expand file tree Collapse file tree
helidon/src/main/java/com/ak/helidon Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,13 +89,22 @@ public void routing(HttpRules rules) {
8989 rules .get ("/" , (_ , res ) -> {
9090 String send ;
9191 if (nowWinner .get () == 0L ) {
92- send = "%d%n%n%s" .formatted (answers .size (), users .values ().stream ().collect (Collectors .joining ("%n" .formatted ())));
92+ send = "%d%n%n%s" .formatted (answers .size (), users .entrySet ().stream ().sorted (Map .Entry .comparingByKey ())
93+ .map (e -> {
94+ if (winners .contains (e .getKey ())) {
95+ return "WIN %s" .formatted (e .getValue ());
96+ }
97+ else {
98+ return e .getValue ();
99+ }
100+ })
101+ .collect (Collectors .joining ("%n" .formatted ())));
93102 }
94103 else {
95104 send = this .answers .entrySet ().stream ()
96105 .collect (Collectors .toMap (e -> users .get (e .getKey ()), e -> {
97106 if (nowWinner .get () == e .getKey ()) {
98- return e .getValue () + " WIN " ;
107+ return "%d WIN" . formatted ( e .getValue ()) ;
99108 }
100109 else {
101110 return e .getValue ();
You can’t perform that action at this time.
0 commit comments