K
- Key类型V
- Value类型public class MapBuilder<K,V> extends Object implements Builder<Map<K,V>>
Constructor and Description |
---|
MapBuilder(Map<K,V> map)
链式Map创建类
|
Modifier and Type | Method and Description |
---|---|
Map<K,V> |
build()
创建后的map
|
MapBuilder<K,V> |
clear()
清空Map
|
static <K,V> MapBuilder<K,V> |
create()
创建Builder,默认HashMap实现
|
static <K,V> MapBuilder<K,V> |
create(boolean isLinked)
创建Builder
|
static <K,V> MapBuilder<K,V> |
create(Map<K,V> map)
创建Builder
|
String |
join(String separator,
String keyValueSeparator)
将map转成字符串
|
String |
join(String separator,
String keyValueSeparator,
boolean isIgnoreNull)
将map转成字符串
|
String |
joinIgnoreNull(String separator,
String keyValueSeparator)
将map转成字符串
|
Map<K,V> |
map()
创建后的map
|
MapBuilder<K,V> |
put(boolean condition,
K k,
Supplier<V> supplier)
链式Map创建
|
MapBuilder<K,V> |
put(boolean condition,
K k,
V v)
链式Map创建
|
MapBuilder<K,V> |
put(K k,
V v)
链式Map创建
|
MapBuilder<K,V> |
putAll(Map<K,V> map)
链式Map创建
|
public static <K,V> MapBuilder<K,V> create()
K
- Key类型V
- Value类型public static <K,V> MapBuilder<K,V> create(boolean isLinked)
K
- Key类型V
- Value类型isLinked
- true创建LinkedHashMap,false创建HashMappublic static <K,V> MapBuilder<K,V> create(Map<K,V> map)
K
- Key类型V
- Value类型map
- Map实体类public MapBuilder<K,V> put(K k, V v)
k
- Key类型v
- Value类型public MapBuilder<K,V> put(boolean condition, K k, V v)
condition
- put条件k
- Key类型v
- Value类型public MapBuilder<K,V> put(boolean condition, K k, Supplier<V> supplier)
condition
- put条件k
- Key类型supplier
- Value类型结果提供方public MapBuilder<K,V> clear()
public String join(String separator, String keyValueSeparator)
separator
- entry之间的连接符keyValueSeparator
- kv之间的连接符public String joinIgnoreNull(String separator, String keyValueSeparator)
separator
- entry之间的连接符keyValueSeparator
- kv之间的连接符Copyright © 2024. All rights reserved.