|
|
@@ -35,16 +35,19 @@ public class BaseArray {
|
|
|
return ArrayUtils.iterator(that, begin, end);
|
|
|
}
|
|
|
|
|
|
- public static <T> Stream<T> stream(T[] that) {
|
|
|
- return Arrays.stream(that);
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ public static <T> Stream<T> stream(Object[] that) {
|
|
|
+ return (Stream<T>)Arrays.stream(that);
|
|
|
}
|
|
|
|
|
|
- public static <T> Stream<T> stream(T[] that, int begin, int end) {
|
|
|
- return Arrays.stream(that, begin, end);
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ public static <T> Stream<T> stream(Object[] that, int begin, int end) {
|
|
|
+ return (Stream<T>)Arrays.stream(that, begin, end);
|
|
|
}
|
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
public static <T> List<T> list(CQueryAbstract<T> that) {
|
|
|
- return (List)Arrays.asList(that.array());
|
|
|
+ return (List<T>)Arrays.asList(that.array());
|
|
|
}
|
|
|
|
|
|
public static <T> Set<T> set(CQueryAbstract<T> that) {
|
|
|
@@ -64,6 +67,7 @@ public class BaseArray {
|
|
|
return at(array, array.length-1);
|
|
|
}
|
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
public static <T> Optional<T> at(Object[] a, int index) {
|
|
|
return index < a.length ? Optional.of((T) a[index]) : Optional.empty();
|
|
|
}
|
|
|
@@ -76,9 +80,10 @@ public class BaseArray {
|
|
|
return at(a, a.length - 1);
|
|
|
}
|
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
public static <A, T> boolean whileEach(A[] array, Predicate<? super T> consumer) {
|
|
|
- for(int index = 0, n = array.length; index<n; index++) {
|
|
|
- if( !consumer.test((T)array[index])) {
|
|
|
+ for (A a : array) {
|
|
|
+ if (!consumer.test((T) a)) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -89,6 +94,7 @@ public class BaseArray {
|
|
|
return whileEach(that.array(), consumer);
|
|
|
}
|
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
public static <A, T> boolean whileEach(CQueryAbstract<T> that, Predicates.EachPredicate<? super T> consumer) {
|
|
|
Object[] array = that.array();
|
|
|
for(int index = 0, n = array.length; index<n; index++) {
|