Fixed failing tests/errors
This commit is contained in:
parent
63ef68fb95
commit
5e67e45910
|
@ -7,7 +7,6 @@
|
|||
- Added: ComputeNonDefault functions which will contain the current behavior of the Compute function, while the Compute will be changed to be more java compliant!
|
||||
- Fixed: SetValue wasn't working on forEach implementations.
|
||||
|
||||
|
||||
### Version 0.8.0
|
||||
- Added: getFirst/getLast/removeFirst/removeLast to Lists
|
||||
- Added: Dedicated implementations for toArray into TreeSets
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.function.Consumer;
|
|||
#endif
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.IntFunction;
|
||||
#endif
|
||||
#if !TYPE_OBJECT && JDK_FUNCTION
|
||||
import java.util.function.PREDICATE;
|
||||
|
@ -1080,6 +1081,12 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
|
|||
return a;
|
||||
}
|
||||
|
||||
#else
|
||||
@Override
|
||||
public <E> E[] toArray(IntFunction<E[]> action) {
|
||||
return super.toArray(action);
|
||||
}
|
||||
|
||||
#endif
|
||||
/**
|
||||
* A function to return the size of the list
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.function.Consumer;
|
|||
import java.util.function.Supplier;
|
||||
#if TYPE_OBJECT
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.IntFunction;
|
||||
#endif
|
||||
#if !TYPE_OBJECT && JDK_FUNCTION
|
||||
import java.util.function.PREDICATE;
|
||||
|
@ -1331,6 +1332,11 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER
|
|||
if (a.length > size) a[size] = EMPTY_KEY_VALUE;
|
||||
return a;
|
||||
}
|
||||
#else
|
||||
@Override
|
||||
public <E> E[] toArray(IntFunction<E[]> action) {
|
||||
return super.toArray(action);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -484,7 +484,8 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T
|
|||
@Override
|
||||
public KEY_TYPE[] TO_ARRAY(KEY_TYPE[] a) {
|
||||
if(a == null || a.length < size()) a = new KEY_TYPE[size()];
|
||||
for(int i = nullIndex-1, index = 0;i>=0;i--) {
|
||||
if(containsNull) a[0] = EMPTY_KEY_VALUE;
|
||||
for(int i = nullIndex-1, index = containsNull ? 1 : 0;i>=0;i--) {
|
||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) a[index++] = keys[i];
|
||||
}
|
||||
if (a.length > size) a[size] = EMPTY_KEY_VALUE;
|
||||
|
@ -497,7 +498,8 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T
|
|||
public Object[] toArray() {
|
||||
if(isEmpty()) return ObjectArrays.EMPTY_ARRAY;
|
||||
Object[] obj = new Object[size()];
|
||||
for(int i = nullIndex-1, index = 0;i>=0;i--) {
|
||||
if(containsNull) obj[0] = KEY_TO_OBJ(EMPTY_KEY_VALUE);
|
||||
for(int i = nullIndex-1, index = containsNull ? 1 : 0;i>=0;i--) {
|
||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) obj[index++] = KEY_TO_OBJ(keys[i]);
|
||||
}
|
||||
return obj;
|
||||
|
@ -508,7 +510,8 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T
|
|||
public <E> E[] toArray(E[] a) {
|
||||
if(a == null) a = (E[])new Object[size()];
|
||||
else if(a.length < size()) a = (E[])ObjectArrays.newArray(a.getClass().getComponentType(), size());
|
||||
for(int i = nullIndex-1, index = 0;i>=0;i--) {
|
||||
if(containsNull) a[0] = (E)KEY_TO_OBJ(EMPTY_KEY_VALUE);
|
||||
for(int i = nullIndex-1, index = containsNull ? 1 : 0;i>=0;i--) {
|
||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) a[index++] = (E)KEY_TO_OBJ(keys[i]);
|
||||
}
|
||||
if (a.length > size) a[size] = null;
|
||||
|
|
|
@ -374,7 +374,8 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp
|
|||
@Override
|
||||
public KEY_TYPE[] TO_ARRAY(KEY_TYPE[] a) {
|
||||
if(a == null || a.length < size()) a = new KEY_TYPE[size()];
|
||||
for(int i = nullIndex-1, index = 0;i>=0;i--) {
|
||||
if(containsNull) a[0] = EMPTY_KEY_VALUE;
|
||||
for(int i = nullIndex-1, index = containsNull ? 1 : 0;i>=0;i--) {
|
||||
if(KEY_EQUALS_NOT_NULL(keys[i])) a[index++] = keys[i];
|
||||
}
|
||||
if (a.length > size) a[size] = EMPTY_KEY_VALUE;
|
||||
|
@ -387,7 +388,8 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp
|
|||
public Object[] toArray() {
|
||||
if(isEmpty()) return ObjectArrays.EMPTY_ARRAY;
|
||||
Object[] obj = new Object[size()];
|
||||
for(int i = nullIndex-1, index = 0;i>=0;i--) {
|
||||
if(containsNull) obj[0] = KEY_TO_OBJ(EMPTY_KEY_VALUE);
|
||||
for(int i = nullIndex-1, index = containsNull ? 1 : 0;i>=0;i--) {
|
||||
if(KEY_EQUALS_NOT_NULL(keys[i])) obj[index++] = KEY_TO_OBJ(keys[i]);
|
||||
}
|
||||
return obj;
|
||||
|
@ -398,7 +400,8 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp
|
|||
public <E> E[] toArray(E[] a) {
|
||||
if(a == null) a = (E[])new Object[size()];
|
||||
else if(a.length < size()) a = (E[])ObjectArrays.newArray(a.getClass().getComponentType(), size());
|
||||
for(int i = nullIndex-1, index = 0;i>=0;i--) {
|
||||
if(containsNull) a[0] = (E)KEY_TO_OBJ(EMPTY_KEY_VALUE);
|
||||
for(int i = nullIndex-1, index = containsNull ? 1 : 0;i>=0;i--) {
|
||||
if(KEY_EQUALS_NOT_NULL(keys[i])) a[index++] = (E)KEY_TO_OBJ(keys[i]);
|
||||
}
|
||||
if (a.length > size) a[size] = null;
|
||||
|
|
Loading…
Reference in New Issue