Fixed Java9 or newer issues.

This commit is contained in:
Speiger 2022-12-15 17:13:34 +01:00
parent 9df95c0fc3
commit 859d00da16
6 changed files with 172 additions and 7 deletions

View File

@ -182,7 +182,7 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection<CLASS_TYPE>, ITE
* @return an array containing all of the elements in this collection
* @see Collection#toArray(Object[])
*/
default KEY_TYPE[] TO_ARRAY(IntFunction<KEY_TYPE[]> action) {
default <E> E[] TO_ARRAY(IntFunction<E[]> action) {
return TO_ARRAY(action.apply(size()));
}

View File

@ -288,12 +288,12 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
* @param action is the creator function of said Array to ensure type is kept.
* @return a new Array of all elements
*/
default KEY_TYPE[] TO_ARRAY(IntFunction<KEY_TYPE[]> action) {
default <E> E[] TO_ARRAY(IntFunction<E[]> action) {
ISizeProvider prov = ISizeProvider.of(this);
if(prov != null) {
int size = prov.size();
if(size >= 0) {
KEY_TYPE[] array = action.apply(size);
E[] array = action.apply(size);
ITERATORS.unwrap(array, iterator());
return array;
}

View File

@ -992,7 +992,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
#else
@Override
public T[] toArray(IntFunction<T[]> action) {
public <E> E[] toArray(IntFunction<E[]> action) {
return super.toArray(action);
}

View File

@ -188,7 +188,7 @@ public interface PRIORITY_QUEUE KEY_GENERIC_TYPE extends ITERABLE KEY_GENERIC_TY
* @return an array containing all of the elements in this collection
* @see Collection#toArray(Object[])
*/
default KEY_TYPE[] TO_ARRAY(IntFunction<KEY_TYPE[]> action) {
default <E> E[] TO_ARRAY(IntFunction<E[]> action) {
return TO_ARRAY(action.apply(size()));
}
#endif

View File

@ -146,7 +146,7 @@ public class ARRAYS
* @param action that is creating the Array to be poured into
* @return array with all elements of the iterator
*/
public static GENERIC_KEY_BRACES KEY_TYPE[] pour(ITERATOR KEY_GENERIC_TYPE iter, IntFunction<KEY_TYPE[]> action) {
public static <T, E> E[] pour(ITERATOR KEY_GENERIC_TYPE iter, IntFunction<E[]> action) {
return pour(iter, Integer.MAX_VALUE, action);
}
@ -158,7 +158,7 @@ public class ARRAYS
* @ArrayType(T)
* @return array with all requested elements of the iterator
*/
public static GENERIC_KEY_BRACES KEY_TYPE[] pour(ITERATOR KEY_GENERIC_TYPE iter, int max, IntFunction<KEY_TYPE[]> action) {
public static <T, E> E[] pour(ITERATOR KEY_GENERIC_TYPE iter, int max, IntFunction<E[]> action) {
COLLECTIONS.CollectionWrapper KEY_GENERIC_TYPE list = COLLECTIONS.wrapper();
ITERATORS.pour(iter, list, max);
return list.TO_ARRAY(action.apply(list.size()));

View File

@ -0,0 +1,165 @@
/** @author Speiger */
module speiger.src.collections {
exports speiger.src.collections.booleans.collections;
exports speiger.src.collections.booleans.functions;
exports speiger.src.collections.booleans.functions.consumer;
exports speiger.src.collections.booleans.functions.function;
exports speiger.src.collections.booleans.lists;
exports speiger.src.collections.booleans.misc.pairs;
exports speiger.src.collections.booleans.misc.pairs.impl;
exports speiger.src.collections.booleans.queues;
exports speiger.src.collections.booleans.utils;
exports speiger.src.collections.bytes.collections;
exports speiger.src.collections.bytes.functions;
exports speiger.src.collections.bytes.functions.consumer;
exports speiger.src.collections.bytes.functions.function;
exports speiger.src.collections.bytes.lists;
exports speiger.src.collections.bytes.maps.abstracts;
exports speiger.src.collections.bytes.maps.impl.concurrent;
exports speiger.src.collections.bytes.maps.impl.customHash;
exports speiger.src.collections.bytes.maps.impl.hash;
exports speiger.src.collections.bytes.maps.impl.immutable;
exports speiger.src.collections.bytes.maps.impl.misc;
exports speiger.src.collections.bytes.maps.impl.tree;
exports speiger.src.collections.bytes.maps.interfaces;
exports speiger.src.collections.bytes.misc.pairs;
exports speiger.src.collections.bytes.misc.pairs.impl;
exports speiger.src.collections.bytes.queues;
exports speiger.src.collections.bytes.sets;
exports speiger.src.collections.bytes.utils;
exports speiger.src.collections.bytes.utils.maps;
exports speiger.src.collections.chars.collections;
exports speiger.src.collections.chars.functions;
exports speiger.src.collections.chars.functions.consumer;
exports speiger.src.collections.chars.functions.function;
exports speiger.src.collections.chars.lists;
exports speiger.src.collections.chars.maps.abstracts;
exports speiger.src.collections.chars.maps.impl.concurrent;
exports speiger.src.collections.chars.maps.impl.customHash;
exports speiger.src.collections.chars.maps.impl.hash;
exports speiger.src.collections.chars.maps.impl.immutable;
exports speiger.src.collections.chars.maps.impl.misc;
exports speiger.src.collections.chars.maps.impl.tree;
exports speiger.src.collections.chars.maps.interfaces;
exports speiger.src.collections.chars.misc.pairs;
exports speiger.src.collections.chars.misc.pairs.impl;
exports speiger.src.collections.chars.queues;
exports speiger.src.collections.chars.sets;
exports speiger.src.collections.chars.utils;
exports speiger.src.collections.chars.utils.maps;
exports speiger.src.collections.doubles.collections;
exports speiger.src.collections.doubles.functions;
exports speiger.src.collections.doubles.functions.consumer;
exports speiger.src.collections.doubles.functions.function;
exports speiger.src.collections.doubles.lists;
exports speiger.src.collections.doubles.maps.abstracts;
exports speiger.src.collections.doubles.maps.impl.concurrent;
exports speiger.src.collections.doubles.maps.impl.customHash;
exports speiger.src.collections.doubles.maps.impl.hash;
exports speiger.src.collections.doubles.maps.impl.immutable;
exports speiger.src.collections.doubles.maps.impl.misc;
exports speiger.src.collections.doubles.maps.impl.tree;
exports speiger.src.collections.doubles.maps.interfaces;
exports speiger.src.collections.doubles.misc.pairs;
exports speiger.src.collections.doubles.misc.pairs.impl;
exports speiger.src.collections.doubles.queues;
exports speiger.src.collections.doubles.sets;
exports speiger.src.collections.doubles.utils;
exports speiger.src.collections.doubles.utils.maps;
exports speiger.src.collections.floats.collections;
exports speiger.src.collections.floats.functions;
exports speiger.src.collections.floats.functions.consumer;
exports speiger.src.collections.floats.functions.function;
exports speiger.src.collections.floats.lists;
exports speiger.src.collections.floats.maps.abstracts;
exports speiger.src.collections.floats.maps.impl.concurrent;
exports speiger.src.collections.floats.maps.impl.customHash;
exports speiger.src.collections.floats.maps.impl.hash;
exports speiger.src.collections.floats.maps.impl.immutable;
exports speiger.src.collections.floats.maps.impl.misc;
exports speiger.src.collections.floats.maps.impl.tree;
exports speiger.src.collections.floats.maps.interfaces;
exports speiger.src.collections.floats.misc.pairs;
exports speiger.src.collections.floats.misc.pairs.impl;
exports speiger.src.collections.floats.queues;
exports speiger.src.collections.floats.sets;
exports speiger.src.collections.floats.utils;
exports speiger.src.collections.floats.utils.maps;
exports speiger.src.collections.ints.collections;
exports speiger.src.collections.ints.functions;
exports speiger.src.collections.ints.functions.consumer;
exports speiger.src.collections.ints.functions.function;
exports speiger.src.collections.ints.lists;
exports speiger.src.collections.ints.maps.abstracts;
exports speiger.src.collections.ints.maps.impl.concurrent;
exports speiger.src.collections.ints.maps.impl.customHash;
exports speiger.src.collections.ints.maps.impl.hash;
exports speiger.src.collections.ints.maps.impl.immutable;
exports speiger.src.collections.ints.maps.impl.misc;
exports speiger.src.collections.ints.maps.impl.tree;
exports speiger.src.collections.ints.maps.interfaces;
exports speiger.src.collections.ints.misc.pairs;
exports speiger.src.collections.ints.misc.pairs.impl;
exports speiger.src.collections.ints.queues;
exports speiger.src.collections.ints.sets;
exports speiger.src.collections.ints.utils;
exports speiger.src.collections.ints.utils.maps;
exports speiger.src.collections.longs.collections;
exports speiger.src.collections.longs.functions;
exports speiger.src.collections.longs.functions.consumer;
exports speiger.src.collections.longs.functions.function;
exports speiger.src.collections.longs.lists;
exports speiger.src.collections.longs.maps.abstracts;
exports speiger.src.collections.longs.maps.impl.concurrent;
exports speiger.src.collections.longs.maps.impl.customHash;
exports speiger.src.collections.longs.maps.impl.hash;
exports speiger.src.collections.longs.maps.impl.immutable;
exports speiger.src.collections.longs.maps.impl.misc;
exports speiger.src.collections.longs.maps.impl.tree;
exports speiger.src.collections.longs.maps.interfaces;
exports speiger.src.collections.longs.misc.pairs;
exports speiger.src.collections.longs.misc.pairs.impl;
exports speiger.src.collections.longs.queues;
exports speiger.src.collections.longs.sets;
exports speiger.src.collections.longs.utils;
exports speiger.src.collections.longs.utils.maps;
exports speiger.src.collections.objects.collections;
exports speiger.src.collections.objects.functions;
exports speiger.src.collections.objects.functions.consumer;
exports speiger.src.collections.objects.functions.function;
exports speiger.src.collections.objects.lists;
exports speiger.src.collections.objects.maps.abstracts;
exports speiger.src.collections.objects.maps.impl.concurrent;
exports speiger.src.collections.objects.maps.impl.customHash;
exports speiger.src.collections.objects.maps.impl.hash;
exports speiger.src.collections.objects.maps.impl.immutable;
exports speiger.src.collections.objects.maps.impl.misc;
exports speiger.src.collections.objects.maps.impl.tree;
exports speiger.src.collections.objects.maps.interfaces;
exports speiger.src.collections.objects.misc.pairs;
exports speiger.src.collections.objects.misc.pairs.impl;
exports speiger.src.collections.objects.queues;
exports speiger.src.collections.objects.sets;
exports speiger.src.collections.objects.utils;
exports speiger.src.collections.objects.utils.maps;
exports speiger.src.collections.shorts.collections;
exports speiger.src.collections.shorts.functions;
exports speiger.src.collections.shorts.functions.consumer;
exports speiger.src.collections.shorts.functions.function;
exports speiger.src.collections.shorts.lists;
exports speiger.src.collections.shorts.maps.abstracts;
exports speiger.src.collections.shorts.maps.impl.concurrent;
exports speiger.src.collections.shorts.maps.impl.customHash;
exports speiger.src.collections.shorts.maps.impl.hash;
exports speiger.src.collections.shorts.maps.impl.immutable;
exports speiger.src.collections.shorts.maps.impl.misc;
exports speiger.src.collections.shorts.maps.impl.tree;
exports speiger.src.collections.shorts.maps.interfaces;
exports speiger.src.collections.shorts.misc.pairs;
exports speiger.src.collections.shorts.misc.pairs.impl;
exports speiger.src.collections.shorts.queues;
exports speiger.src.collections.shorts.sets;
exports speiger.src.collections.shorts.utils;
exports speiger.src.collections.shorts.utils.maps;
exports speiger.src.collections.utils;
}