|
|
@ -1,10 +1,7 @@ |
|
|
|
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
|
|
|
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
|
|
|
package org.jetbrains.java.decompiler.util; |
|
|
|
package org.jetbrains.java.decompiler.util; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
import java.util.*; |
|
|
|
import java.util.HashSet; |
|
|
|
|
|
|
|
import java.util.Iterator; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class FastSparseSetFactory<E> { |
|
|
|
public class FastSparseSetFactory<E> { |
|
|
|
|
|
|
|
|
|
|
@ -97,15 +94,7 @@ public class FastSparseSetFactory<E> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public FastSparseSet<E> getCopy() { |
|
|
|
public FastSparseSet<E> getCopy() { |
|
|
|
|
|
|
|
return new FastSparseSet<>(factory, data.clone(), next.clone()); |
|
|
|
int arrlength = data.length; |
|
|
|
|
|
|
|
int[] cpdata = new int[arrlength]; |
|
|
|
|
|
|
|
int[] cpnext = new int[arrlength]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.arraycopy(data, 0, cpdata, 0, arrlength); |
|
|
|
|
|
|
|
System.arraycopy(next, 0, cpnext, 0, arrlength); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new FastSparseSet<>(factory, cpdata, cpnext); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int[] ensureCapacity(int index) { |
|
|
|
private int[] ensureCapacity(int index) { |
|
|
@ -119,15 +108,10 @@ public class FastSparseSetFactory<E> { |
|
|
|
newlength *= 2; |
|
|
|
newlength *= 2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int[] newdata = new int[newlength]; |
|
|
|
data = Arrays.copyOf(data, newlength); |
|
|
|
System.arraycopy(data, 0, newdata, 0, data.length); |
|
|
|
next = Arrays.copyOf(next, newlength); |
|
|
|
data = newdata; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int[] newnext = new int[newlength]; |
|
|
|
return data; |
|
|
|
System.arraycopy(next, 0, newnext, 0, next.length); |
|
|
|
|
|
|
|
next = newnext; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return newdata; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void add(E element) { |
|
|
|
public void add(E element) { |
|
|
|