From 8fc51f66c6c3d24749db4e68672338024ecb8911 Mon Sep 17 00:00:00 2001 From: mchristen Date: Tue, 26 Sep 2023 15:39:34 +0200 Subject: [PATCH] fixed a test class which prevented compilation on latest jvm --- source/net/yacy/cora/sorting/Array.java | 27 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/source/net/yacy/cora/sorting/Array.java b/source/net/yacy/cora/sorting/Array.java index c71081fae..3cb2b7284 100644 --- a/source/net/yacy/cora/sorting/Array.java +++ b/source/net/yacy/cora/sorting/Array.java @@ -118,12 +118,12 @@ public class Array { (x.compare(_c, _b) < 0 ? b : x.compare(_c, _a) < 0 ? c : a)); } - private static class P extends ArrayList implements Sortable { + private static class P implements Sortable { - private static final long serialVersionUID = 1L; + private ArrayList list; public P() { - super(); + this.list = new ArrayList(); } @Override @@ -138,21 +138,30 @@ public class Array { @Override public void swap(final int i, final int j, Integer buffer) { - buffer = this.get(i); - this.set(i, this.get(j)); - this.set(j, buffer); + buffer = this.list.get(i); + this.list.set(i, this.list.get(j)); + this.list.set(j, buffer); } @Override public void delete(final int i) { - this.remove(i); + this.list.remove(i); } @Override public Integer get(final int i, final boolean clone) { - return this.get(i); + return this.list.get(i); } + @Override + public int size() { + return list.size(); + } + + public void add(int nextInt) { + this.list.add(nextInt); + } + } public static void uniq(final Sortable x) { @@ -185,7 +194,7 @@ public class Array { sort(test); final long t1 = System.currentTimeMillis(); System.out.println("sort = " + (t1 - t0) + "ms"); - //uniq(test); + uniq(test); final long t2 = System.currentTimeMillis(); System.out.println("uniq = " + (t2 - t1) + "ms"); System.out.println("result: " + test.size());