Repository: incubator-ignite Updated Branches: refs/heads/ignite-sql-tests 4ec4e5d64 -> 24c6f90a3
ignite-sql-tests - simplified popular numbers Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/24c6f90a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/24c6f90a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/24c6f90a Branch: refs/heads/ignite-sql-tests Commit: 24c6f90a306035682ad71a1b1d30ebd0c2435705 Parents: 4ec4e5d Author: S.Vladykin <svlady...@gridgain.com> Authored: Tue Feb 10 10:07:45 2015 +0300 Committer: S.Vladykin <svlady...@gridgain.com> Committed: Tue Feb 10 10:07:45 2015 +0300 ---------------------------------------------------------------------- .../examples/datagrid/CachePopularNumbersExample.java | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/24c6f90a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java index dfaf707..0f71681 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java @@ -121,20 +121,8 @@ public class CachePopularNumbersExample { List<List<?>> results = new ArrayList<>(cache.queryFields( sql("select _key, _val from Long order by _val desc limit ?").setArgs(cnt)).getAll()); - Collections.sort(results, new Comparator<List<?>>() { - @Override public int compare(List<?> r1, List<?> r2) { - long cnt1 = (Long)r1.get(1); - long cnt2 = (Long)r2.get(1); - - return cnt1 < cnt2 ? 1 : cnt1 > cnt2 ? -1 : 0; - } - }); - - for (int i = 0; i < cnt && i < results.size(); i++) { - List<?> res = results.get(i); - + for (List<?> res : results) System.out.println(res.get(0) + "=" + res.get(1)); - } System.out.println("----------------"); }