Changed that function names are closer to javas names.

This commit is contained in:
2022-12-15 16:07:44 +01:00
parent 127eb71968
commit d6d2c0a396
7 changed files with 32 additions and 14 deletions
@@ -12,7 +12,7 @@ import java.util.stream.StreamSupport;
#endif
#if TYPE_OBJECT
import java.util.function.Consumer;
import speiger.src.collections.ints.functions.function.Int2ObjectFunction;
import java.util.function.IntFunction;
#else
import speiger.src.collections.PACKAGE.functions.CONSUMER;
#endif
@@ -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(Int2ObjectFunction<KEY_TYPE[]> action) {
default KEY_TYPE[] TO_ARRAY(IntFunction<KEY_TYPE[]> action) {
return TO_ARRAY(action.apply(size()));
}
@@ -13,8 +13,8 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR;
import speiger.src.collections.objects.collections.ObjectIterable;
#else
import java.util.function.BiFunction;
import java.util.function.IntFunction;
import java.util.Comparator;
import speiger.src.collections.ints.functions.function.Int2ObjectFunction;
#endif
import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION;
@@ -288,7 +288,7 @@ 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(Int2ObjectFunction<KEY_TYPE[]> action) {
default KEY_TYPE[] TO_ARRAY(IntFunction<KEY_TYPE[]> action) {
ISizeProvider prov = ISizeProvider.of(this);
if(prov != null) {
int size = prov.size();
@@ -4,6 +4,7 @@ package speiger.src.collections.PACKAGE.lists;
#if DEQUEUE_FEATURE
import java.util.Comparator;
#endif
import java.util.function.BiFunction;
#else if PRIMITIVES
import java.nio.JAVA_BUFFER;
@@ -18,6 +19,9 @@ import java.util.Spliterator.JAVA_SPLIT_ITERATOR;
#endif
import java.util.function.Consumer;
import java.util.function.Predicate;
#if TYPE_OBJECT
import java.util.function.IntFunction;
#endif
#if !TYPE_OBJECT && JDK_FUNCTION
import java.util.function.PREDICATE;
#endif
@@ -36,8 +40,6 @@ import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
import speiger.src.collections.PACKAGE.collections.COLLECTION;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.collections.STACK;
#else
import speiger.src.collections.ints.functions.function.Int2ObjectFunction;
#endif
import speiger.src.collections.PACKAGE.collections.ITERATOR;
#if DEQUEUE_FEATURE
@@ -990,7 +992,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
#else
@Override
public T[] toArray(Int2ObjectFunction<T[]> action) {
public T[] toArray(IntFunction<T[]> action) {
return super.toArray(action);
}
@@ -4,8 +4,7 @@ package speiger.src.collections.PACKAGE.queues;
import java.util.Comparator;
import java.util.Collection;
import java.util.Iterator;
import speiger.src.collections.ints.functions.function.Int2ObjectFunction;
import java.util.function.IntFunction;
#else
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#endif
@@ -189,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(Int2ObjectFunction<KEY_TYPE[]> action) {
default KEY_TYPE[] TO_ARRAY(IntFunction<KEY_TYPE[]> action) {
return TO_ARRAY(action.apply(size()));
}
#endif
@@ -8,8 +8,8 @@ import java.util.concurrent.RecursiveAction;
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#else
import java.util.Comparator;
import java.util.function.IntFunction;
import speiger.src.collections.ints.functions.function.Int2ObjectFunction;
#endif
import speiger.src.collections.PACKAGE.collections.ITERATOR;
import speiger.src.collections.PACKAGE.utils.ITERATORS;
@@ -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, Int2ObjectFunction<KEY_TYPE[]> action) {
public static GENERIC_KEY_BRACES KEY_TYPE[] pour(ITERATOR KEY_GENERIC_TYPE iter, IntFunction<KEY_TYPE[]> 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, Int2ObjectFunction<KEY_TYPE[]> action) {
public static GENERIC_KEY_BRACES KEY_TYPE[] pour(ITERATOR KEY_GENERIC_TYPE iter, int max, IntFunction<KEY_TYPE[]> action) {
COLLECTIONS.CollectionWrapper KEY_GENERIC_TYPE list = COLLECTIONS.wrapper();
ITERATORS.pour(iter, list, max);
return list.TO_ARRAY(action.apply(list.size()));