mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-08 14:48:01 +08:00
fix type
This commit is contained in:
parent
0685a8a141
commit
a418b5922b
@ -504,7 +504,7 @@ public class BeanUtil {
|
|||||||
* @return Map
|
* @return Map
|
||||||
*/
|
*/
|
||||||
public static Map<String, Object> beanToMap(Object bean, boolean isToUnderlineCase, boolean ignoreNullValue) {
|
public static Map<String, Object> beanToMap(Object bean, boolean isToUnderlineCase, boolean ignoreNullValue) {
|
||||||
return beanToMap(bean, new LinkedHashMap<>(), isToUnderlineCase, ignoreNullValue);
|
return beanToMap(bean, new LinkedHashMap<String, Object>(), isToUnderlineCase, ignoreNullValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -476,10 +476,10 @@ public class CollUtil {
|
|||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public static <T> HashSet<T> newHashSet(boolean isSorted, T... ts) {
|
public static <T> HashSet<T> newHashSet(boolean isSorted, T... ts) {
|
||||||
if (null == ts) {
|
if (null == ts) {
|
||||||
return isSorted ? new LinkedHashSet<>() : new HashSet<>();
|
return isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
|
||||||
}
|
}
|
||||||
int initialCapacity = Math.max((int) (ts.length / .75f) + 1, 16);
|
int initialCapacity = Math.max((int) (ts.length / .75f) + 1, 16);
|
||||||
final HashSet<T> set = isSorted ? new LinkedHashSet<>(initialCapacity) : new HashSet<>(initialCapacity);
|
final HashSet<T> set = isSorted ? new LinkedHashSet<T>(initialCapacity) : new HashSet<T>(initialCapacity);
|
||||||
Collections.addAll(set, ts);
|
Collections.addAll(set, ts);
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ public class CollUtil {
|
|||||||
if (null == iter) {
|
if (null == iter) {
|
||||||
return newHashSet(isSorted, (T[]) null);
|
return newHashSet(isSorted, (T[]) null);
|
||||||
}
|
}
|
||||||
final HashSet<T> set = isSorted ? new LinkedHashSet<>() : new HashSet<>();
|
final HashSet<T> set = isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
set.add(iter.next());
|
set.add(iter.next());
|
||||||
}
|
}
|
||||||
@ -540,7 +540,7 @@ public class CollUtil {
|
|||||||
if (null == enumeration) {
|
if (null == enumeration) {
|
||||||
return newHashSet(isSorted, (T[]) null);
|
return newHashSet(isSorted, (T[]) null);
|
||||||
}
|
}
|
||||||
final HashSet<T> set = isSorted ? new LinkedHashSet<>() : new HashSet<>();
|
final HashSet<T> set = isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
|
||||||
while (enumeration.hasMoreElements()) {
|
while (enumeration.hasMoreElements()) {
|
||||||
set.add(enumeration.nextElement());
|
set.add(enumeration.nextElement());
|
||||||
}
|
}
|
||||||
@ -558,7 +558,7 @@ public class CollUtil {
|
|||||||
* @since 4.1.2
|
* @since 4.1.2
|
||||||
*/
|
*/
|
||||||
public static <T> List<T> list(boolean isLinked) {
|
public static <T> List<T> list(boolean isLinked) {
|
||||||
return isLinked ? new LinkedList<>() : new ArrayList<>();
|
return isLinked ? new LinkedList<T>() : new ArrayList<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -575,7 +575,7 @@ public class CollUtil {
|
|||||||
if (ArrayUtil.isEmpty(values)) {
|
if (ArrayUtil.isEmpty(values)) {
|
||||||
return list(isLinked);
|
return list(isLinked);
|
||||||
}
|
}
|
||||||
final List<T> arrayList = isLinked ? new LinkedList<>() : new ArrayList<>(values.length);
|
final List<T> arrayList = isLinked ? new LinkedList<T>() : new ArrayList<T>(values.length);
|
||||||
Collections.addAll(arrayList, values);
|
Collections.addAll(arrayList, values);
|
||||||
return arrayList;
|
return arrayList;
|
||||||
}
|
}
|
||||||
@ -751,7 +751,7 @@ public class CollUtil {
|
|||||||
* @return {@link CopyOnWriteArrayList}
|
* @return {@link CopyOnWriteArrayList}
|
||||||
*/
|
*/
|
||||||
public static <T> CopyOnWriteArrayList<T> newCopyOnWriteArrayList(Collection<T> collection) {
|
public static <T> CopyOnWriteArrayList<T> newCopyOnWriteArrayList(Collection<T> collection) {
|
||||||
return (null == collection) ? (new CopyOnWriteArrayList<>()) : (new CopyOnWriteArrayList<>(collection));
|
return (null == collection) ? (new CopyOnWriteArrayList<T>()) : (new CopyOnWriteArrayList<T>(collection));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1028,7 +1028,7 @@ public class CollUtil {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<T> list2 = (list instanceof LinkedList) ? new LinkedList<>() : new ArrayList<>(list.size());
|
final List<T> list2 = (list instanceof LinkedList) ? new LinkedList<T>() : new ArrayList<T>(list.size());
|
||||||
T modified;
|
T modified;
|
||||||
for (T t : list) {
|
for (T t : list) {
|
||||||
modified = editor.edit(t);
|
modified = editor.edit(t);
|
||||||
@ -1092,7 +1092,7 @@ public class CollUtil {
|
|||||||
if (null == list || null == filter) {
|
if (null == list || null == filter) {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
final List<T> list2 = (list instanceof LinkedList) ? new LinkedList<>() : new ArrayList<>(list.size());
|
final List<T> list2 = (list instanceof LinkedList) ? new LinkedList<T>() : new ArrayList<T>(list.size());
|
||||||
for (T t : list) {
|
for (T t : list) {
|
||||||
if (filter.accept(t)) {
|
if (filter.accept(t)) {
|
||||||
list2.add(t);
|
list2.add(t);
|
||||||
|
@ -62,7 +62,7 @@ public class MapUtil {
|
|||||||
* @since 4.6.3
|
* @since 4.6.3
|
||||||
*/
|
*/
|
||||||
public static <K, V> Map<K, V> emptyIfNull(Map<K, V> set) {
|
public static <K, V> Map<K, V> emptyIfNull(Map<K, V> set) {
|
||||||
return (null == set) ? Collections.emptyMap() : set;
|
return (null == set) ? Collections.<K, V>emptyMap() : set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,7 +105,7 @@ public class MapUtil {
|
|||||||
*/
|
*/
|
||||||
public static <K, V> HashMap<K, V> newHashMap(int size, boolean isOrder) {
|
public static <K, V> HashMap<K, V> newHashMap(int size, boolean isOrder) {
|
||||||
int initialCapacity = (int) (size / DEFAULT_LOAD_FACTOR) + 1;
|
int initialCapacity = (int) (size / DEFAULT_LOAD_FACTOR) + 1;
|
||||||
return isOrder ? new LinkedHashMap<>(initialCapacity) : new HashMap<>(initialCapacity);
|
return isOrder ? new LinkedHashMap<K, V>(initialCapacity) : new HashMap<K, V>(initialCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -775,7 +775,7 @@ public class MapUtil {
|
|||||||
* @return map创建类
|
* @return map创建类
|
||||||
*/
|
*/
|
||||||
public static <K, V> MapBuilder<K, V> builder() {
|
public static <K, V> MapBuilder<K, V> builder() {
|
||||||
return builder(new HashMap<>());
|
return builder(new HashMap<K, V>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -312,7 +312,7 @@ public class NetUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CollectionUtil.addAll(new ArrayList<>(), networkInterfaces);
|
return CollectionUtil.addAll(new ArrayList<NetworkInterface>(), networkInterfaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +57,7 @@ public class Simhash {
|
|||||||
this.hammingThresh = hammingThresh;
|
this.hammingThresh = hammingThresh;
|
||||||
this.storage = new ArrayList<>(fracCount);
|
this.storage = new ArrayList<>(fracCount);
|
||||||
for (int i = 0; i < fracCount; i++) {
|
for (int i = 0; i < fracCount; i++) {
|
||||||
storage.add(new HashMap<>());
|
storage.add(new HashMap<String, List<Long>>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user