This commit is contained in:
Looly 2022-08-28 19:54:30 +08:00
parent 82fb4e22b1
commit 83798c3bf7
2 changed files with 4 additions and 5 deletions

View File

@ -1181,11 +1181,9 @@ public class EasyStream<T> implements Stream<T>, Iterable<T> {
* @param idx 下标
* @return 指定下标的元素
*/
@SuppressWarnings("unchecked")
public Optional<T> at(final Integer idx) {
return Opt.ofNullable(idx).map(i -> {
//noinspection unchecked
return (T) ArrayUtil.get(toArray(), i);
}).toOptional();
return Opt.ofNullable(idx).map(i -> (T) ArrayUtil.get(toArray(), i)).toOptional();
}
/**

View File

@ -1025,7 +1025,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
if (null == array) {
return null;
}
if(null == indexes){
if (null == indexes) {
return newArray(array.getClass().getComponentType(), 0);
}
@ -1553,6 +1553,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
* 是否存在{@code null}或空对象通过{@link ObjUtil#isEmpty(Object)} 判断元素<br>
* 如果提供数组本身为空
*
* @param <T> 元素类型
* @param args 被检查对象
* @return 是否存在
* @since 4.5.18