mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
1.更新 Convert.toMap方法注释,格式化代码
2.删除mapToMapWithSelfTypeTest方法多余空行
This commit is contained in:
parent
de52d71031
commit
bb85c40924
@ -601,7 +601,7 @@ public class Convert {
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为Map,若value原本就是Map,则使用原始类型若不是
|
||||
* 转换为Map,若value原本就是Map,则转为原始类型,若不是则默认转为HashMap
|
||||
*
|
||||
* @param <K> 键类型
|
||||
* @param <V> 值类型
|
||||
@ -613,10 +613,10 @@ public class Convert {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <K, V> Map<K, V> toMap(Class<K> keyType, Class<V> valueType, Object value) {
|
||||
if(value instanceof Map){
|
||||
return toMap((Class<? extends Map>) value.getClass(), keyType, valueType,value);
|
||||
}else{
|
||||
return toMap(HashMap.class, keyType, valueType,value);
|
||||
if (value instanceof Map) {
|
||||
return toMap((Class<? extends Map>) value.getClass(), keyType, valueType, value);
|
||||
} else {
|
||||
return toMap(HashMap.class, keyType, valueType, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,6 @@ public class ConvertToBeanTest {
|
||||
}
|
||||
@Test
|
||||
public void mapToMapWithSelfTypeTest() {
|
||||
|
||||
CaseInsensitiveMap<String, Integer> caseInsensitiveMap = new CaseInsensitiveMap<>();
|
||||
caseInsensitiveMap.put("jerry", 1);
|
||||
caseInsensitiveMap.put("Jerry", 2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user