This commit is contained in:
Looly 2023-04-23 22:51:14 +08:00
parent 06e091fc4a
commit 435de4e602
3 changed files with 6 additions and 16 deletions

View File

@ -33,6 +33,7 @@ public class ArrayWrapper<A, E> implements Wrapper<A>, Iterable<E> {
* @param componentType 元素类型
* @param length 长度
* @param <A> 数组类型
* @param <E> 数组元素类型
* @return ArrayWrapper
*/
@SuppressWarnings("unchecked")
@ -313,7 +314,7 @@ public class ArrayWrapper<A, E> implements Wrapper<A>, Iterable<E> {
* @return 新数组
*/
public ArrayWrapper<A, E> insert(final int index, final E element) {
return insertArray(index, createSingleElementArray(element));
return insertArray(index, ArrayUtil.ofArray(element));
}
/**
@ -612,19 +613,5 @@ public class ArrayWrapper<A, E> implements Wrapper<A>, Iterable<E> {
this.array = newArray;
this.length = Array.getLength(newArray);
}
/**
* 创建单一元素数组
*
* @param value 元素值
* @return 数组
*/
@SuppressWarnings("unchecked")
private A createSingleElementArray(final E value) {
// 插入单个元素
final A newInstance = (A) Array.newInstance(this.componentType, 1);
Array.set(newInstance, 0, value);
return newInstance;
}
// endregion
}

View File

@ -22,6 +22,9 @@ import org.dromara.hutool.core.map.WeakConcurrentMap;
* @author Looly
*/
public enum BeanDescCache {
/**
* 单例
*/
INSTANCE;
private final WeakConcurrentMap<Class<?>, BeanDesc> bdCache = new WeakConcurrentMap<>();

View File

@ -11,7 +11,6 @@
*/
package org.dromara.hutool.core.collection.queue;
import org.dromara.hutool.core.collection.queue.CheckedLinkedBlockingQueue;
import org.dromara.hutool.core.thread.SimpleScheduler;
import org.dromara.hutool.core.util.RuntimeUtil;
@ -28,6 +27,7 @@ import java.util.function.Predicate;
* Apache incubator-shenyu</a>
* </p>
*
* @param <E> 元素类型
* @author incubator-shenyu
* @since 6.0.0
*/