/*
- * Copyright (c) 2017. Developed by Hedgecode.
+ * Copyright (c) 2017-2020. Developed by Hedgecode.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.hedgecode.snooker.json;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
*
* @author Dmitry Samoshin aka gotty
*/
-public class JsonRankings extends JsonCollectionEntity<Ranking> implements Rankings {
+public class JsonRankings extends JsonCollectionEntity<Ranking> implements Rankings, Serializable {
- protected JsonRankings(Ranking[] entities) {
+ private static final long serialVersionUID = -1765390719034378729L;
+
+ private static final JsonRankings EMPTY = new JsonRankings(new Ranking[0]);
+
+ JsonRankings(Ranking[] entities) {
super(entities);
}
- protected JsonRankings(List<Ranking> entities) {
+ JsonRankings(List<Ranking> entities) {
super(entities);
}
for (Ranking ranking : this)
if (ranking.sum() >= minSum && ranking.sum() <= maxSum)
rankings.add(ranking);
- return rankings.isEmpty() ? null : new JsonRankings(rankings);
+ return rankings.isEmpty() ? EMPTY : new JsonRankings(rankings);
}
@Override
RankingComparators.SUM.comparator()
);
}
+
}