Simplify forDifferencesBetweenArray

This commit is contained in:
TheMode 2021-08-01 14:10:47 +02:00
parent 9a74051cdb
commit 515b5358da

View File

@ -32,19 +32,16 @@ public final class ArrayUtils {
public static void forDifferencesBetweenArray(long @NotNull [] a, long @NotNull [] b, public static void forDifferencesBetweenArray(long @NotNull [] a, long @NotNull [] b,
@NotNull LongConsumer consumer) { @NotNull LongConsumer consumer) {
loop:
for (final long aValue : a) { for (final long aValue : a) {
boolean contains = false;
for (final long bValue : b) { for (final long bValue : b) {
if (bValue == aValue) { if (bValue == aValue) {
contains = true; continue loop;
break;
} }
} }
if (!contains) {
consumer.accept(aValue); consumer.accept(aValue);
} }
} }
}
public static int @NotNull [] toArray(@NotNull IntList list) { public static int @NotNull [] toArray(@NotNull IntList list) {
int[] array = new int[list.size()]; int[] array = new int[list.size()];