mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-04 04:37:59 +08:00
fix type
This commit is contained in:
parent
0685a8a141
commit
a418b5922b
@ -504,7 +504,7 @@ public class BeanUtil {
|
||||
* @return Map
|
||||
*/
|
||||
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
|
||||
public static <T> HashSet<T> newHashSet(boolean isSorted, T... 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);
|
||||
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);
|
||||
return set;
|
||||
}
|
||||
@ -520,7 +520,7 @@ public class CollUtil {
|
||||
if (null == iter) {
|
||||
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()) {
|
||||
set.add(iter.next());
|
||||
}
|
||||
@ -540,7 +540,7 @@ public class CollUtil {
|
||||
if (null == enumeration) {
|
||||
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()) {
|
||||
set.add(enumeration.nextElement());
|
||||
}
|
||||
@ -558,7 +558,7 @@ public class CollUtil {
|
||||
* @since 4.1.2
|
||||
*/
|
||||
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)) {
|
||||
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);
|
||||
return arrayList;
|
||||
}
|
||||
@ -751,7 +751,7 @@ public class CollUtil {
|
||||
* @return {@link CopyOnWriteArrayList}
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
for (T t : list) {
|
||||
modified = editor.edit(t);
|
||||
@ -1092,7 +1092,7 @@ public class CollUtil {
|
||||
if (null == list || null == filter) {
|
||||
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) {
|
||||
if (filter.accept(t)) {
|
||||
list2.add(t);
|
||||
|
@ -62,7 +62,7 @@ public class MapUtil {
|
||||
* @since 4.6.3
|
||||
*/
|
||||
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) {
|
||||
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创建类
|
||||
*/
|
||||
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 CollectionUtil.addAll(new ArrayList<>(), networkInterfaces);
|
||||
return CollectionUtil.addAll(new ArrayList<NetworkInterface>(), networkInterfaces);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,7 @@ public class Simhash {
|
||||
this.hammingThresh = hammingThresh;
|
||||
this.storage = new ArrayList<>(fracCount);
|
||||
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