|
@@ -6,10 +6,12 @@ import dsl.FrameworkBench.World;
|
|
|
import javax.servlet.ServletException;
|
|
|
import javax.servlet.http.*;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
+import java.util.*;
|
|
|
|
|
|
public class UpdatesServlet extends HttpServlet {
|
|
|
|
|
|
+ private static final Comparator<World> ASC = (l, r) -> l.getId() - r.getId();
|
|
|
+
|
|
|
@Override
|
|
|
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
|
|
|
res.setContentType("application/json");
|
|
@@ -22,6 +24,7 @@ public class UpdatesServlet extends HttpServlet {
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
changed.add(worlds[i].setRandomNumber(ctx.getRandom10k()));
|
|
|
}
|
|
|
+ Collections.sort(changed, ASC);
|
|
|
ctx.repository.update(changed);
|
|
|
json.serialize(worlds, count);
|
|
|
json.toStream(res.getOutputStream());
|