Fixed recent found bugs

-Fixed: addAll with non Specific Collections was crashing lists.
-Fixed/Refactor: Clear and trim implementation was all over the place
-Fixed: Wrappers toString/hashCode/equals function wasn't implemented
-Added: Tests for addAll bug
-Refactor: Did small code style cleanups as I was fixing bugs.
This commit is contained in:
Speiger 2021-09-13 17:02:24 +02:00
parent ec817fb9c2
commit e30ca4103f
15 changed files with 197 additions and 151 deletions

View File

@ -68,7 +68,7 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection<CLASS_TYPE>, ITE
@Primitive @Primitive
public boolean containsAny(Collection<?> c); public boolean containsAny(Collection<?> c);
#if !TYPE_OBJECT #if !TYPE_OBJECT
/** /**
* A Type-Specific remove function that reduces (un)boxing. * A Type-Specific remove function that reduces (un)boxing.
* @param o the element that should be removed * @param o the element that should be removed

View File

@ -238,7 +238,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
if(index != size) System.arraycopy(data, index, data, index+add, size - index); if(index != size) System.arraycopy(data, index, data, index+add, size - index);
size+=add; size+=add;
Iterator<? extends CLASS_TYPE> iter = c.iterator(); Iterator<? extends CLASS_TYPE> iter = c.iterator();
while(add != 0) data[index++] = OBJ_TO_KEY(iter.next()); while(add-- != 0) data[index++] = OBJ_TO_KEY(iter.next());
return true; return true;
} }
@ -935,6 +935,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
return; return;
} }
data = size == 0 ? EMPTY_KEY_ARRAY : NEW_KEY_ARRAY(size); data = size == 0 ? EMPTY_KEY_ARRAY : NEW_KEY_ARRAY(size);
this.size = size;
} }
/** /**

View File

@ -423,6 +423,24 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
firstIndex = lastIndex = -1; firstIndex = lastIndex = -1;
} }
@Override
public void clearAndTrim(int size) {
int request = Math.max(minCapacity, HashUtil.nextPowerOfTwo((int)Math.ceil(size / loadFactor)));
if(size >= request) {
clear();
return;
}
nullIndex = request;
mask = request-1;
maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1);
keys = NEW_KEY_ARRAY(request + 1);
values = NEW_VALUE_ARRAY(request + 1);
links = new long[request + 1];
firstIndex = lastIndex = -1;
this.size = 0;
containsNull = false;
}
protected void moveToFirstIndex(int startPos) { protected void moveToFirstIndex(int startPos) {
if(size == 1 || firstIndex == startPos) return; if(size == 1 || firstIndex == startPos) return;
if(lastIndex == startPos) { if(lastIndex == startPos) {

View File

@ -534,8 +534,18 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
@Override @Override
public void clearAndTrim(int size) { public void clearAndTrim(int size) {
clear(); int request = Math.max(minCapacity, HashUtil.nextPowerOfTwo((int)Math.ceil(size / loadFactor)));
trim(size); if(size >= request) {
clear();
return;
}
nullIndex = request;
mask = request-1;
maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1);
keys = NEW_KEY_ARRAY(request + 1);
values = NEW_VALUE_ARRAY(request + 1);
this.size = 0;
containsNull = false;
} }
#if !TYPE_OBJECT #if !TYPE_OBJECT

View File

@ -403,6 +403,24 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
firstIndex = lastIndex = -1; firstIndex = lastIndex = -1;
} }
@Override
public void clearAndTrim(int size) {
int request = Math.max(minCapacity, HashUtil.nextPowerOfTwo((int)Math.ceil(size / loadFactor)));
if(size >= request) {
clear();
return;
}
nullIndex = request;
mask = request-1;
maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1);
keys = NEW_KEY_ARRAY(request + 1);
values = NEW_VALUE_ARRAY(request + 1);
links = new long[request + 1];
firstIndex = lastIndex = -1;
this.size = 0;
containsNull = false;
}
protected void moveToFirstIndex(int startPos) { protected void moveToFirstIndex(int startPos) {
if(size == 1 || firstIndex == startPos) return; if(size == 1 || firstIndex == startPos) return;
if(lastIndex == startPos) { if(lastIndex == startPos) {

View File

@ -495,8 +495,18 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
@Override @Override
public void clearAndTrim(int size) { public void clearAndTrim(int size) {
clear(); int request = Math.max(minCapacity, HashUtil.nextPowerOfTwo((int)Math.ceil(size / loadFactor)));
trim(size); if(size >= request) {
clear();
return;
}
nullIndex = request;
mask = request-1;
maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1);
keys = NEW_KEY_ARRAY(request + 1);
values = NEW_VALUE_ARRAY(request + 1);
this.size = 0;
containsNull = false;
} }
#if !TYPE_OBJECT #if !TYPE_OBJECT

View File

@ -1,5 +1,6 @@
package speiger.src.collections.PACKAGE.maps.impl.misc; package speiger.src.collections.PACKAGE.maps.impl.misc;
import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
#if VALUE_OBJECT #if VALUE_OBJECT
@ -193,6 +194,14 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE
return valuesC; return valuesC;
} }
@Override
public void clear() {
if(size == 0) return;
size = 0;
Arrays.fill(present, 0L);
Arrays.fill(values, EMPTY_VALUE);
}
protected void onNodeAdded(int index) { protected void onNodeAdded(int index) {
} }

View File

@ -505,17 +505,19 @@ public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY
@Override @Override
public void clearAndTrim(int size) { public void clearAndTrim(int size) {
if(nullIndex <= size) { int request = Math.max(minCapacity, HashUtil.nextPowerOfTwo((int)Math.ceil(size / loadFactor)));
if(size >= request) {
clear(); clear();
return; return;
} }
nullIndex = size; nullIndex = request;
mask = nullIndex - 1; mask = request-1;
maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1); maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1);
keys = NEW_KEY_ARRAY(nullIndex + 1); keys = NEW_KEY_ARRAY(request + 1);
links = new long[nullIndex + 1]; links = new long[request + 1];
firstIndex = -1; firstIndex = lastIndex = -1;
lastIndex = -1; this.size = 0;
containsNull = false;
} }
@Override @Override

View File

@ -486,17 +486,19 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
@Override @Override
public void clearAndTrim(int size) { public void clearAndTrim(int size) {
if(nullIndex <= size) { int request = Math.max(minCapacity, HashUtil.nextPowerOfTwo((int)Math.ceil(size / loadFactor)));
if(size >= request) {
clear(); clear();
return; return;
} }
nullIndex = size; nullIndex = request;
mask = nullIndex - 1; mask = request-1;
maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1); maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1);
keys = NEW_KEY_ARRAY(nullIndex + 1); keys = NEW_KEY_ARRAY(request + 1);
links = new long[nullIndex + 1]; links = new long[request + 1];
firstIndex = -1; firstIndex = lastIndex = -1;
lastIndex = -1; this.size = 0;
containsNull = false;
} }
@Override @Override

View File

@ -354,14 +354,17 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T
@Override @Override
public void clearAndTrim(int size) { public void clearAndTrim(int size) {
if(nullIndex <= size) { int request = Math.max(minCapacity, HashUtil.nextPowerOfTwo((int)Math.ceil(size / loadFactor)));
if(size >= request) {
clear(); clear();
return; return;
} }
nullIndex = size; nullIndex = request;
mask = nullIndex - 1; mask = request-1;
maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1); maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1);
keys = NEW_KEY_ARRAY(nullIndex + 1); keys = NEW_KEY_ARRAY(request + 1);
this.size = 0;
containsNull = false;
} }
private void ensureCapacity(int newCapacity) { private void ensureCapacity(int newCapacity) {

View File

@ -312,14 +312,17 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp
@Override @Override
public void clearAndTrim(int size) { public void clearAndTrim(int size) {
if(nullIndex <= size) { int request = Math.max(minCapacity, HashUtil.nextPowerOfTwo((int)Math.ceil(size / loadFactor)));
if(size >= request) {
clear(); clear();
return; return;
} }
nullIndex = size; nullIndex = request;
mask = nullIndex - 1; mask = request-1;
maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1); maxFill = Math.min((int)Math.ceil(nullIndex * loadFactor), nullIndex - 1);
keys = NEW_KEY_ARRAY(nullIndex + 1); keys = NEW_KEY_ARRAY(request + 1);
this.size = 0;
containsNull = false;
} }
@Override @Override

View File

@ -5,12 +5,14 @@ import java.util.function.Predicate;
#if PRIMITIVES #if PRIMITIVES
import java.util.function.JAVA_PREDICATE; import java.util.function.JAVA_PREDICATE;
#endif #endif
import java.util.function.Consumer;
import speiger.src.collections.PACKAGE.collections.ABSTRACT_COLLECTION; import speiger.src.collections.PACKAGE.collections.ABSTRACT_COLLECTION;
import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.COLLECTION;
import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.collections.ITERATOR;
import speiger.src.collections.objects.utils.ObjectArrays; import speiger.src.collections.objects.utils.ObjectArrays;
#if !TYPE_OBJECT #if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.functions.CONSUMER;
import speiger.src.collections.PACKAGE.utils.ARRAYS; import speiger.src.collections.PACKAGE.utils.ARRAYS;
#endif #endif
@ -151,23 +153,32 @@ public class COLLECTIONS
#endif #endif
@Override @Override
public void clear() { synchronized(mutex) { c.clear(); } } public void clear() { synchronized(mutex) { c.clear(); } }
@Override @Override
public Object[] toArray() { synchronized(mutex) { return c.toArray(); } } public Object[] toArray() { synchronized(mutex) { return c.toArray(); } }
#if !TYPE_OBJECT #if !TYPE_OBJECT
@Override @Override
public <T> T[] toArray(T[] a) { synchronized(mutex) { return c.toArray(a); } } public <T> T[] toArray(T[] a) { synchronized(mutex) { return c.toArray(a); } }
@Override @Override
public KEY_TYPE[] TO_ARRAY() { synchronized(mutex) { return c.TO_ARRAY(); } } public KEY_TYPE[] TO_ARRAY() { synchronized(mutex) { return c.TO_ARRAY(); } }
@Override @Override
public KEY_TYPE[] TO_ARRAY(KEY_TYPE[] a) { synchronized(mutex) { return c.TO_ARRAY(a); } } public KEY_TYPE[] TO_ARRAY(KEY_TYPE[] a) { synchronized(mutex) { return c.TO_ARRAY(a); } }
@Override
public void forEach(CONSUMER action) { synchronized(mutex) { c.forEach(action); } }
@Override
@Deprecated
public void forEach(Consumer<? super CLASS_TYPE> action) { synchronized(mutex) { c.forEach(action); } }
#else #else
@Override @Override
public <E> E[] toArray(E[] a) { synchronized(mutex) { return c.toArray(a); } } public <E> E[] toArray(E[] a) { synchronized(mutex) { return c.toArray(a); } }
@Override
public void forEach(Consumer<? super CLASS_TYPE> action) { synchronized(mutex) { c.forEach(action); } }
#endif #endif
@Override
public int hashCode() { synchronized(mutex) { return c.hashCode(); } }
@Override
public boolean equals(Object obj) { synchronized(mutex) { return c.equals(obj); } }
@Override
public String toString() { synchronized(mutex) { return c.toString(); } }
} }
/** /**
@ -187,57 +198,29 @@ public class COLLECTIONS
public boolean addAll(Collection<? extends CLASS_TYPE> c) { throw new UnsupportedOperationException(); } public boolean addAll(Collection<? extends CLASS_TYPE> c) { throw new UnsupportedOperationException(); }
@Override @Override
public boolean addAll(COLLECTION KEY_GENERIC_TYPE c) { throw new UnsupportedOperationException(); } public boolean addAll(COLLECTION KEY_GENERIC_TYPE c) { throw new UnsupportedOperationException(); }
#if !TYPE_OBJECT #if !TYPE_OBJECT
@Override @Override
public boolean contains(KEY_TYPE o) { public boolean contains(KEY_TYPE o) { return c.contains(o); }
return c.contains(o);
}
#else #else
@Override @Override
public boolean contains(Object o) { public boolean contains(Object o) { return c.contains(o); }
return c.contains(o);
}
#endif #endif
@Override @Override
public boolean containsAll(COLLECTION KEY_GENERIC_TYPE c) { public boolean containsAll(COLLECTION KEY_GENERIC_TYPE c) { return this.c.containsAll(c); }
return this.c.containsAll(c);
}
@Override @Override
public boolean containsAny(COLLECTION KEY_GENERIC_TYPE c) { public boolean containsAny(COLLECTION KEY_GENERIC_TYPE c) { return this.c.containsAny(c); }
return this.c.containsAny(c);
}
@Override @Override
@Primitive @Primitive
public boolean containsAny(Collection<?> c) { public boolean containsAny(Collection<?> c) { return this.c.containsAny(c); }
return this.c.containsAny(c);
}
@Override @Override
@Primitive @Primitive
public boolean containsAll(Collection<?> c) { public boolean containsAll(Collection<?> c) { return this.c.containsAll(c); }
return this.c.containsAll(c);
}
@Override @Override
public int size() { public int size() { return c.size(); }
return c.size();
}
@Override @Override
public boolean isEmpty() { public boolean isEmpty() { return c.isEmpty(); }
return c.isEmpty();
}
@Override @Override
public ITERATOR KEY_GENERIC_TYPE iterator() { public ITERATOR KEY_GENERIC_TYPE iterator() { return ITERATORS.unmodifiable(c.iterator()); }
return ITERATORS.unmodifiable(c.iterator());
}
@Override @Override
@Deprecated @Deprecated
public boolean remove(Object o) { throw new UnsupportedOperationException(); } public boolean remove(Object o) { throw new UnsupportedOperationException(); }
@ -264,35 +247,32 @@ public class COLLECTIONS
#endif #endif
@Override @Override
public void clear() { throw new UnsupportedOperationException(); } public void clear() { throw new UnsupportedOperationException(); }
@Override @Override
public Object[] toArray() { public Object[] toArray() { return c.toArray(); }
return c.toArray();
}
#if !TYPE_OBJECT #if !TYPE_OBJECT
@Override @Override
public <T> T[] toArray(T[] a) { public <T> T[] toArray(T[] a) { return c.toArray(a); }
return c.toArray(a);
}
@Override @Override
public KEY_TYPE[] TO_ARRAY() { public KEY_TYPE[] TO_ARRAY() { return c.TO_ARRAY(); }
return c.TO_ARRAY();
}
@Override @Override
public KEY_TYPE[] TO_ARRAY(KEY_TYPE[] a) { public KEY_TYPE[] TO_ARRAY(KEY_TYPE[] a) { return c.TO_ARRAY(a); }
return c.TO_ARRAY(a); @Override
} public void forEach(CONSUMER action) { c.forEach(action); }
@Override
@Deprecated
public void forEach(Consumer<? super CLASS_TYPE> action) { c.forEach(action); }
#else #else
@Override @Override
public <E> E[] toArray(E[] a) { public <E> E[] toArray(E[] a) { return c.toArray(a); }
return c.toArray(a); @Override
} public void forEach(Consumer<? super CLASS_TYPE> action) { c.forEach(action); }
#endif #endif
@Override
public int hashCode() { return c.hashCode(); }
@Override
public boolean equals(Object obj) { return c.equals(obj); }
@Override
public String toString() { return c.toString(); }
} }
/** /**
@ -308,43 +288,23 @@ public class COLLECTIONS
#if !TYPE_OBJECT #if !TYPE_OBJECT
@Override @Override
public boolean contains(KEY_TYPE o) { public boolean contains(KEY_TYPE o) { return false; }
return false;
}
@Override @Override
public boolean containsAll(COLLECTION KEY_GENERIC_TYPE c) { public boolean containsAll(COLLECTION KEY_GENERIC_TYPE c) { return false; }
return false;
}
@Override @Override
public boolean containsAny(COLLECTION KEY_GENERIC_TYPE c) { public boolean containsAny(COLLECTION KEY_GENERIC_TYPE c) { return false; }
return false;
}
#else #else
@Override @Override
public boolean contains(Object o) { public boolean contains(Object o) { return false; }
return false;
}
#endif #endif
@Override @Override
@Primitive @Primitive
public boolean containsAny(Collection<?> c) { public boolean containsAny(Collection<?> c) { return false; }
return false;
}
@Override @Override
@Primitive @Primitive
public boolean containsAll(Collection<?> c) { public boolean containsAll(Collection<?> c) { return false; }
return false;
}
@Override @Override
public int hashCode() { public int hashCode() { return 0; }
return 0;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
@ -377,47 +337,24 @@ public class COLLECTIONS
@Override @Override
public boolean remIf(JAVA_PREDICATE filter){ throw new UnsupportedOperationException(); } public boolean remIf(JAVA_PREDICATE filter){ throw new UnsupportedOperationException(); }
#endif #endif
@Override @Override
public Object[] toArray() { public Object[] toArray() { return ObjectArrays.EMPTY_ARRAY; }
return ObjectArrays.EMPTY_ARRAY;
}
#if !TYPE_OBJECT #if !TYPE_OBJECT
@Override @Override
public <T> T[] toArray(T[] a) { public <T> T[] toArray(T[] a) { return a; }
return a;
}
@Override @Override
public KEY_TYPE[] TO_ARRAY() { public KEY_TYPE[] TO_ARRAY() { return ARRAYS.EMPTY_ARRAY; }
return ARRAYS.EMPTY_ARRAY;
}
@Override @Override
public KEY_TYPE[] TO_ARRAY(KEY_TYPE[] a) { public KEY_TYPE[] TO_ARRAY(KEY_TYPE[] a) { return a; }
return a;
}
#else #else
@Override @Override
public <E> E[] toArray(E[] a) { public <E> E[] toArray(E[] a) { return a; }
return a;
}
#endif #endif
@Override @Override
public ITERATOR KEY_GENERIC_TYPE iterator() { public ITERATOR KEY_GENERIC_TYPE iterator() { return ITERATORS.empty(); }
return ITERATORS.empty();
}
@Override @Override
public void clear() { public void clear() {}
}
@Override @Override
public int size() { public int size() { return 0; }
return 0;
}
} }
} }

View File

@ -2,6 +2,7 @@ package speiger.src.collections.ints.base;
import java.util.Arrays; import java.util.Arrays;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import org.junit.Assert; import org.junit.Assert;
@ -12,6 +13,7 @@ import speiger.src.collections.ints.utils.IntArrays;
import speiger.src.collections.ints.utils.IntCollections; import speiger.src.collections.ints.utils.IntCollections;
import speiger.src.collections.ints.utils.IntCollections.SynchronizedCollection; import speiger.src.collections.ints.utils.IntCollections.SynchronizedCollection;
import speiger.src.collections.ints.utils.IntCollections.UnmodifiableCollection; import speiger.src.collections.ints.utils.IntCollections.UnmodifiableCollection;
import speiger.src.collections.objects.lists.ObjectArrayList;
import speiger.src.collections.tests.CollectionTest; import speiger.src.collections.tests.CollectionTest;
@SuppressWarnings("javadoc") @SuppressWarnings("javadoc")
@ -47,6 +49,9 @@ public abstract class BaseIntCollectionTest extends BaseIntIterableTest
Assert.assertEquals(TEST_ARRAY.length, collection.size()); Assert.assertEquals(TEST_ARRAY.length, collection.size());
collection.addAll(create(BULK_ADD_ARRAY)); collection.addAll(create(BULK_ADD_ARRAY));
Assert.assertEquals(TEST_ARRAY.length + BULK_ADD_ARRAY.length, collection.size()); Assert.assertEquals(TEST_ARRAY.length + BULK_ADD_ARRAY.length, collection.size());
// Testing if adding via non Type Specific work like they should
List<Integer> wrapper = new ObjectArrayList<>(create(ADD_ARRAY));
Assert.assertNotNull(create(ADD_ARRAY).addAll(wrapper));
} }
@Test @Test
@ -163,4 +168,14 @@ public abstract class BaseIntCollectionTest extends BaseIntIterableTest
collection = IntCollections.unmodifiable(collection); collection = IntCollections.unmodifiable(collection);
Assert.assertTrue(collection instanceof UnmodifiableCollection); Assert.assertTrue(collection instanceof UnmodifiableCollection);
} }
@Test
public void testToString() {
if(!getValidCollectionTests().contains(CollectionTest.TO_STRING)) return;
String base = Arrays.toString(BULK_ADD_ARRAY);
IntCollection collection = create(BULK_ADD_ARRAY);
Assert.assertEquals(base, collection.toString());
Assert.assertEquals(base, IntCollections.synchronize(collection).toString());
Assert.assertEquals(base, IntCollections.unmodifiable(collection).toString());
}
} }

View File

@ -6,6 +6,7 @@ import speiger.src.collections.ints.base.BaseIntCollectionTest;
import speiger.src.collections.ints.base.BaseIntSortedSetTest; import speiger.src.collections.ints.base.BaseIntSortedSetTest;
import speiger.src.collections.ints.collections.IntCollection; import speiger.src.collections.ints.collections.IntCollection;
import speiger.src.collections.ints.utils.IntStrategy; import speiger.src.collections.ints.utils.IntStrategy;
import speiger.src.collections.tests.CollectionTest;
import speiger.src.collections.tests.SortedSetTest; import speiger.src.collections.tests.SortedSetTest;
@SuppressWarnings("javadoc") @SuppressWarnings("javadoc")
@ -21,6 +22,14 @@ public class IntHashSetTests
{ {
@Override @Override
protected IntCollection create(int[] data) { return new IntOpenHashSet(data); } protected IntCollection create(int[] data) { return new IntOpenHashSet(data); }
@Override
protected EnumSet<CollectionTest> getValidCollectionTests()
{
EnumSet<CollectionTest> tests = super.getValidCollectionTests();
tests.remove(CollectionTest.TO_STRING);
return tests;
}
} }
public static class IntLinkedOpenHashSetTests extends BaseIntOpenHashSetTests public static class IntLinkedOpenHashSetTests extends BaseIntOpenHashSetTests
@ -33,6 +42,14 @@ public class IntHashSetTests
{ {
@Override @Override
protected IntCollection create(int[] data) { return new IntOpenCustomHashSet(data, new DefaultStrategy()); } protected IntCollection create(int[] data) { return new IntOpenCustomHashSet(data, new DefaultStrategy()); }
@Override
protected EnumSet<CollectionTest> getValidCollectionTests()
{
EnumSet<CollectionTest> tests = super.getValidCollectionTests();
tests.remove(CollectionTest.TO_STRING);
return tests;
}
} }
public static class IntLinkedOpenCustomHashSetTests extends BaseIntOpenHashSetTests public static class IntLinkedOpenCustomHashSetTests extends BaseIntOpenHashSetTests

View File

@ -14,5 +14,6 @@ public enum CollectionTest
RETAIN_ALL, RETAIN_ALL,
TO_ARRAY, TO_ARRAY,
CLEAR, CLEAR,
WRAPPER; WRAPPER,
TO_STRING;
} }