Package com.landawn.abacus.util
Class Maps
java.lang.Object
com.landawn.abacus.util.Maps
Note: This class includes codes copied from Apache Commons Lang, Google Guava and other open source projects under the Apache License 2.0. The methods copied from other libraries/frameworks/projects may be modified in this class.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionbean2FlatMap
(Object bean) Bean to map.bean2FlatMap
(Object bean, boolean ignoreNullProperty) Bean to map.bean2FlatMap
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames) Bean to map.bean2FlatMap
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.bean2FlatMap
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.bean2FlatMap
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, IntFunction<? extends M> mapSupplier) Bean to map.bean2FlatMap
(Object bean, Collection<String> selectPropNames) Bean to map.bean2FlatMap
(Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.bean2FlatMap
(Object bean, Collection<String> selectPropNames, IntFunction<? extends M> mapSupplier) Bean to map.bean2FlatMap
(Object bean, IntFunction<? extends M> mapSupplier) Bean to map.bean2FlatMap
(M resultMap, Object bean) Bean to map.bean2FlatMap
(M resultMap, Object bean, boolean ignoreNullProperty) Bean to map.bean2FlatMap
(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames) Bean to map.bean2FlatMap
(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.bean2FlatMap
(M resultMap, Object bean, Collection<String> selectPropNames) Bean to map.bean2FlatMap
(M resultMap, Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy) Bean to map.Bean to map.Bean to map.Bean to map.bean2Map
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.bean2Map
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.bean2Map
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, IntFunction<? extends M> mapSupplier) Bean to map.bean2Map
(Object bean, Collection<String> selectPropNames) Bean to map.bean2Map
(Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.bean2Map
(Object bean, Collection<String> selectPropNames, IntFunction<? extends M> mapSupplier) Bean to map.bean2Map
(Object bean, IntFunction<? extends M> mapSupplier) Bean to map.Bean to map.Bean to map.Bean to map.bean2Map
(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.bean2Map
(M resultMap, Object bean, Collection<String> selectPropNames) Bean to map.bean2Map
(M resultMap, Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy) Bean to map.static boolean
static boolean
Check if the specifiedMap
contains the specifiedEntry
.static <T,
K> Map<K, T> create
(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper) static <T,
K, V> Map<K, V> create
(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueExtractor) static <T,
K, V, M extends Map<K, V>>
Mcreate
(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueExtractor, BinaryOperator<V> mergeFunction, IntFunction<? extends M> mapSupplier) static <T,
K, V, M extends Map<K, V>>
Mcreate
(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueExtractor, IntFunction<? extends M> mapSupplier) static <T,
K> Map<K, T> static <T,
K, V> Map<K, V> create
(Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, ? extends V> valueExtractor) static <T,
K, V, M extends Map<K, V>>
Mcreate
(Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, ? extends V> valueExtractor, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapSupplier) static <T,
K, V, M extends Map<K, V>>
Mcreate
(Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, ? extends V> valueExtractor, Supplier<? extends M> mapSupplier) static <K,
V, V2> Map<K, V2> static <K,
V, V2, M extends Map<K, V2>>
Mcreate
(Map<? extends K, ? extends V> map, Function<? super V, V2> valueMapper, IntFunction<? extends M> mapSupplier) deepBean2Map
(Object bean) Bean to map.deepBean2Map
(Object bean, boolean ignoreNullProperty) Bean to map.deepBean2Map
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames) Bean to map.deepBean2Map
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.deepBean2Map
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.deepBean2Map
(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, IntFunction<? extends M> mapSupplier) Bean to map.deepBean2Map
(Object bean, Collection<String> selectPropNames) Bean to map.deepBean2Map
(Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.deepBean2Map
(Object bean, Collection<String> selectPropNames, IntFunction<? extends M> mapSupplier) Bean to map.deepBean2Map
(Object bean, IntFunction<? extends M> mapSupplier) Bean to map.deepBean2Map
(M resultMap, Object bean) Bean to map.deepBean2Map
(M resultMap, Object bean, boolean ignoreNullProperty) Bean to map.deepBean2Map
(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames) Bean to map.deepBean2Map
(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.deepBean2Map
(M resultMap, Object bean, Collection<String> selectPropNames) Bean to map.deepBean2Map
(M resultMap, Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy) Bean to map.static <K,
V> Map<K, Pair<V, u.Nullable<V>>> difference
(Map<K, V> map, Map<K, V> map2) filter
(Map<K, V> map, Throwables.BiPredicate<? super K, ? super V, E> predicate) filterByKey
(Map<K, V> map, Throwables.Predicate<? super K, E> predicate) Filter by key.filterByValue
(Map<K, V> map, Throwables.Predicate<? super V, E> predicate) Filter by value.flatInvert
(Map<K, ? extends Collection<? extends V>> map) flatToMap
(Map<K, ? extends Collection<? extends V>> map) {a=[1, 2, 3], b=[4, 5, 6], c=[7, 8]} -> [{a=1, b=4, c=7}, {a=2, b=5, c=8}, {a=3, b=6}].static <K,
T> u.Optional<T> Returns an emptyOptional<String>
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K,
T> u.Optional<T> Returns an emptyOptional<String>
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K,
T> T Returns the mappedT
or aT
converted fromN.valueOf((Class<T>) defaultForNull.getClass(), N.stringOf(val))
.static <K,
V> u.Nullable<V> static <K,
E> Set<E> getAndPutLinkedHashSetIfAbsent
(Map<K, Set<E>> map, K key) Returns the value associated with the specifiedkey
if it exists in the specifiedmap
contains, or the new putSet
if it's absent.static <K,
E> List<E> getAndPutListIfAbsent
(Map<K, List<E>> map, K key) Returns the value associated with the specifiedkey
if it exists in the specifiedmap
contains, or the new putList
if it's absent.static <K,
KK, VV> Map<KK, VV> getAndPutMapIfAbsent
(Map<K, Map<KK, VV>> map, K key) Returns the value associated with the specifiedkey
if it exists in the specifiedmap
contains, or the new putMap
if it's absent.static <K,
E> Set<E> getAndPutSetIfAbsent
(Map<K, Set<E>> map, K key) Returns the value associated with the specifiedkey
if it exists in the specifiedmap
contains, or the new putSet
if it's absent.static <K> u.OptionalBoolean
getBoolean
(Map<? super K, ?> map, K key) Returns an emptyOptionalBoolean
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K> boolean
getBoolean
(Map<? super K, ?> map, K key, boolean defaultForNull) Returns the mappedboolean
or a boolean converted from String.static <T> T
Recursively get the values from the specifiedmap
bypath
.static <T> T
static <T> u.Nullable<T>
getByPathIfPresent
(Map<?, ?> map, String path) static <T> u.Nullable<T>
getByPathIfPresent
(Map<?, ?> map, String path, Class<? extends T> targetType) static <T> T
getByPathOrDefault
(Map<?, ?> map, String path, T defaultValue) static <K> u.OptionalByte
Returns an emptyOptionalByte
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K> byte
Returns the mappedbyte
or a byte converted from String.static <K> u.OptionalChar
Returns an emptyOptionalChar
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K> char
Returns the mappedchar
or a char converted from String.static <K> u.OptionalDouble
Returns an emptyOptionalDouble
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K> double
Returns the mappeddouble
or a double converted from String.static <K> u.OptionalFloat
Returns an emptyOptionalFloat
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K> float
Returns the mappedfloat
or a float converted from String.static <K,
V> List<V> getIfPresentForEach
(Map<K, ? extends V> map, Collection<?> keys) Returns a list of values of the keys which exist in the specifiedMap
.static <K> u.OptionalInt
Returns an emptyOptionalInt
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K> int
Returns the mappedinteger
or an integer converted from String.static <K> u.OptionalLong
Returns an emptyOptionalLong
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K> long
Returns the mappedlong
or a long converted from String.static <K,
V> V getOrDefault
(Map<K, ? extends V> map, K key, V defaultValue) Returns the value to which the specified key is mapped, ordefaultValue
if this map contains no mapping for the key.static <K,
V> List<V> getOrDefaultForEach
(Map<K, V> map, Collection<?> keys, V defaultValue) Gets the or default for each.static <K,
V> V getOrDefaultIfNull
(Map<K, ? extends V> map, K key, V defaultForNull) Returns the value to which the specified key is mapped if it's notnull
, ordefaultForNull
if this map contains no mapping for the key or it'snull
.static <K,
V> List<V> getOrDefaultIfNullForEach
(Map<K, V> map, Collection<?> keys, V defaultValue) getOrEmptyList
(Map<K, V> map, K key) Returns the value to which the specified key is mapped, or an empty immutableList
if this map contains no mapping for the key.getOrEmptySet
(Map<K, V> map, K key) Returns the value to which the specified key is mapped, or an empty immutableSet
if this map contains no mapping for the key.static <K> u.OptionalShort
Returns an emptyOptionalShort
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K> short
Returns the mappedshort
or a short converted from String.static <K> u.Optional<String>
Returns an emptyOptional<String>
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.static <K> String
Returns the mappedString
or aString
converted fromN.toString(value)
.static <K,
V> Map<K, V> intersection
(Map<K, V> map, Map<?, ?> map2) static <K,
V> Map<V, K> static <K,
V> Map<V, K> invert
(Map<K, V> map, BinaryOperator<K> mergeOp) static <T> List<T>
map2Bean
(Collection<Map<String, Object>> mList, boolean igoreNullProperty, boolean ignoreUnmatchedProperty, Class<? extends T> targetClass) Map to bean.static <T> List<T>
Map to bean.static <T> List<T>
map2Bean
(Collection<Map<String, Object>> mList, Collection<String> selectPropNames, Class<? extends T> targetClass) Map to bean.static <T> T
map2Bean
(Map<String, Object> m, boolean ignoreNullProperty, boolean ignoreUnmatchedProperty, Class<? extends T> targetClass) Map to bean.static <T> T
Map to bean.static <T> T
Map to bean.static <K,
V> void merge
(Map<K, V> map, K key, V value, BinaryOperator<V> remappingFunction) static <K,
V> Map.Entry<K, V> newEntry
(K key, V value) Deprecated.static <K,
V> ImmutableEntry<K, V> newImmutableEntry
(K key, V value) Deprecated.replaced byCommonUtil.newImmutableEntry(Object, Object)
static <K,
V> V putIfAbsent
(Map<K, V> map, K key, Supplier<V> supplier) Put if absent.static <K,
V> V putIfAbsent
(Map<K, V> map, K key, V value) Put if absent.static <K,
V> boolean static <K,
V> boolean Removes the specified entry.static boolean
removeEntries
(Map<?, ?> map, Map<?, ?> entriesToRemove) The the entries from the specifiedMap
.static <K,
V, E extends Exception>
booleanremoveIf
(Map<K, V> map, Throwables.Predicate<? super Map.Entry<K, V>, E> filter) Removes entries from the specifiedmap
by the the specifiedfilter
.static <K,
V, E extends Exception>
booleanremoveIfKey
(Map<K, V> map, Throwables.Predicate<? super K, E> filter) Removes entries from the specifiedmap
by the the specifiedfilter
.static <K,
V, E extends Exception>
booleanremoveIfValue
(Map<K, V> map, Throwables.Predicate<? super V, E> filter) Removes entries from the specifiedmap
by the the specifiedfilter
.static boolean
removeKeys
(Map<?, ?> map, Collection<?> keysToRemove) Removes the keys.static <K,
V> V static <K,
V> boolean static <K,
V, E extends Exception>
voidreplaceAll
(Map<K, V> map, Throwables.BiFunction<? super K, ? super V, ? extends V, E> function) static <K,
V> Map<K, Pair<u.Nullable<V>, u.Nullable<V>>> symmetricDifference
(Map<K, V> map, Map<K, V> map2) static <K,
V> Map<K, V> zip
(Collection<? extends K> keys, Collection<? extends V> values) zip
(Collection<? extends K> keys, Collection<? extends V> values, BinaryOperator<V> mergeFunction, IntFunction<? extends M> mapSupplier) zip
(Collection<? extends K> keys, Collection<? extends V> values, IntFunction<? extends M> mapSupplier)
-
Method Details
-
create
public static <T,K> Map<K,T> create(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper) - Type Parameters:
T
-K
- the key type- Parameters:
c
-keyMapper
-- Returns:
-
create
public static <T,K, Map<K,V> V> create(Collection<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueExtractor) - Type Parameters:
T
-K
- the key typeV
- the value type- Parameters:
c
-keyMapper
-valueExtractor
-- Returns:
-
create
public static <T,K, M createV, M extends Map<K, V>> (Collection<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueExtractor, IntFunction<? extends M> mapSupplier) - Type Parameters:
T
-K
- the key typeV
- the value typeM
-- Parameters:
c
-keyMapper
-valueExtractor
-mapSupplier
-- Returns:
-
create
public static <T,K, M createV, M extends Map<K, V>> (Collection<? extends T> c, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueExtractor, BinaryOperator<V> mergeFunction, IntFunction<? extends M> mapSupplier) - Type Parameters:
T
-K
-V
-M
-- Parameters:
c
-keyMapper
-valueExtractor
-mergeFunction
-mapSupplier
-- Returns:
-
create
- Type Parameters:
T
-K
- the key type- Parameters:
iter
-keyMapper
-- Returns:
-
create
public static <T,K, Map<K,V> V> create(Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, ? extends V> valueExtractor) - Type Parameters:
T
-K
- the key typeV
- the value type- Parameters:
iter
-keyMapper
-valueExtractor
-- Returns:
-
create
public static <T,K, M createV, M extends Map<K, V>> (Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, ? extends V> valueExtractor, Supplier<? extends M> mapSupplier) - Type Parameters:
T
-K
- the key typeV
- the value typeM
-- Parameters:
iter
-keyMapper
-valueExtractor
-mapSupplier
-- Returns:
-
create
public static <T,K, M createV, M extends Map<K, V>> (Iterator<? extends T> iter, Function<? super T, K> keyMapper, Function<? super T, ? extends V> valueExtractor, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapSupplier) - Type Parameters:
T
-K
-V
-M
-- Parameters:
iter
-keyMapper
-valueExtractor
-mergeFunction
-mapSupplier
-- Returns:
-
create
public static <K,V, Map<K,V2> V2> create(Map<? extends K, ? extends V> map, Function<? super V, V2> valueMapper) - Type Parameters:
K
-V
-V2
-- Parameters:
map
-valueMapper
-- Returns:
-
create
public static <K,V, M createV2, M extends Map<K, V2>> (Map<? extends K, ? extends V> map, Function<? super V, V2> valueMapper, IntFunction<? extends M> mapSupplier) - Type Parameters:
K
-V
-V2
-M
-- Parameters:
map
-valueMapper
-mapSupplier
-- Returns:
-
newEntry
Deprecated.replaced byCommonUtil.newEntry(Object, Object)
- Type Parameters:
K
-V
-- Parameters:
key
-value
-- Returns:
-
newImmutableEntry
Deprecated.replaced byCommonUtil.newImmutableEntry(Object, Object)
- Type Parameters:
K
-V
-- Parameters:
key
-value
-- Returns:
-
zip
- Type Parameters:
K
-V
-- Parameters:
keys
-values
-- Returns:
-
zip
public static <K,V, Map<K,M extends Map<K, V>> V> zip(Collection<? extends K> keys, Collection<? extends V> values, IntFunction<? extends M> mapSupplier) - Type Parameters:
K
-V
-M
-- Parameters:
keys
-values
-mapSupplier
-- Returns:
-
zip
public static <K,V, Map<K,M extends Map<K, V>> V> zip(Collection<? extends K> keys, Collection<? extends V> values, BinaryOperator<V> mergeFunction, IntFunction<? extends M> mapSupplier) - Type Parameters:
K
-V
-M
-- Parameters:
keys
-values
-mergeFunction
-mapSupplier
-- Returns:
-
get
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-key
-- Returns:
-
getOrDefault
Returns the value to which the specified key is mapped, ordefaultValue
if this map contains no mapping for the key.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-key
-defaultValue
-- Returns:
-
getOrDefaultIfNull
Returns the value to which the specified key is mapped if it's notnull
, ordefaultForNull
if this map contains no mapping for the key or it'snull
.- Type Parameters:
K
-V
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
getBoolean
Returns an emptyOptionalBoolean
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-- Returns:
-
getBoolean
Returns the mappedboolean
or a boolean converted from String.defaultForNull
is returned if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
getChar
Returns an emptyOptionalChar
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-- Returns:
-
getChar
Returns the mappedchar
or a char converted from String.defaultForNull
is returned if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
getByte
Returns an emptyOptionalByte
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-- Returns:
-
getByte
Returns the mappedbyte
or a byte converted from String.defaultForNull
is returned if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
getShort
Returns an emptyOptionalShort
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-- Returns:
-
getShort
Returns the mappedshort
or a short converted from String.defaultForNull
is returned if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
getInt
Returns an emptyOptionalInt
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-- Returns:
-
getInt
Returns the mappedinteger
or an integer converted from String.defaultForNull
is returned if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
getLong
Returns an emptyOptionalLong
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-- Returns:
-
getLong
Returns the mappedlong
or a long converted from String.defaultForNull
is returned if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
getFloat
Returns an emptyOptionalFloat
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-- Returns:
-
getFloat
Returns the mappedfloat
or a float converted from String.defaultForNull
is returned if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
getDouble
Returns an emptyOptionalDouble
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-- Returns:
-
getDouble
Returns the mappeddouble
or a double converted from String.defaultForNull
is returned if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
getString
Returns an emptyOptional<String>
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-- Returns:
-
getString
Returns the mappedString
or aString
converted fromN.toString(value)
.defaultForNull
is returned if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Type Parameters:
K
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
get
Returns an emptyOptional<String>
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.
Node: To follow one of general design rules inAbacus
, if there is a conversion behind when the source value is not assignable to the target type, put thetargetType
to last parameter of the method. Otherwise, put thetargetTpye
to the first parameter of the method.- Type Parameters:
K
-T
-- Parameters:
map
-key
-targetType
-- Returns:
-
get
public static <K,T> u.Optional<T> get(Map<? super K, ?> map, K key, com.landawn.abacus.type.Type<? extends T> targetType) Returns an emptyOptional<String>
if the specifiedmap
is empty, or no value found by the specifiedkey
, or the value isnull
.
Node: To follow one of general design rules inAbacus
, if there is a conversion behind when the source value is not assignable to the target type, put thetargetType
to last parameter of the method. Otherwise, put thetargetTpye
to the first parameter of the method.- Type Parameters:
K
-T
-- Parameters:
map
-key
-targetType
-- Returns:
-
get
Returns the mappedT
or aT
converted fromN.valueOf((Class<T>) defaultForNull.getClass(), N.stringOf(val))
.defaultForNull
is returned if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Type Parameters:
K
-T
-- Parameters:
map
-key
-defaultForNull
- to return if the specifiedmap
doesn't contain the specifiedkey
or the mapped value isnull
.- Returns:
-
getOrEmptyList
Returns the value to which the specified key is mapped, or an empty immutableList
if this map contains no mapping for the key.- Type Parameters:
K
- the key typeE
-V
- the value type- Parameters:
map
-key
-- Returns:
-
getOrEmptySet
Returns the value to which the specified key is mapped, or an empty immutableSet
if this map contains no mapping for the key.- Type Parameters:
K
- the key typeE
-V
- the value type- Parameters:
map
-key
-- Returns:
-
getAndPutListIfAbsent
Returns the value associated with the specifiedkey
if it exists in the specifiedmap
contains, or the new putList
if it's absent.- Type Parameters:
K
- the key typeE
-- Parameters:
map
-key
-- Returns:
-
getAndPutSetIfAbsent
Returns the value associated with the specifiedkey
if it exists in the specifiedmap
contains, or the new putSet
if it's absent.- Type Parameters:
K
- the key typeE
-- Parameters:
map
-key
-- Returns:
-
getAndPutLinkedHashSetIfAbsent
Returns the value associated with the specifiedkey
if it exists in the specifiedmap
contains, or the new putSet
if it's absent.- Type Parameters:
K
- the key typeE
-- Parameters:
map
-key
-- Returns:
-
getAndPutMapIfAbsent
Returns the value associated with the specifiedkey
if it exists in the specifiedmap
contains, or the new putMap
if it's absent.- Type Parameters:
K
- the key typeKK
-VV
-- Parameters:
map
-key
-- Returns:
-
getIfPresentForEach
Returns a list of values of the keys which exist in the specifiedMap
. If the key dosn't exist in theMap
, No value will be added into the returned list.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-keys
-- Returns:
-
getOrDefaultForEach
Gets the or default for each.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-keys
-defaultValue
-- Returns:
-
getOrDefaultIfNullForEach
public static <K,V> List<V> getOrDefaultIfNullForEach(Map<K, V> map, Collection<?> keys, V defaultValue) - Type Parameters:
K
-V
-- Parameters:
map
-keys
-defaultValue
-- Returns:
-
getByPath
Recursively get the values from the specifiedmap
bypath
. For example:Map map = N.asMap("key1", "val1"); assertEquals("val1", Maps.getByPath(map, "key1")); map = N.asMap("key1", N.asList("val1")); assertEquals("val1", Maps.getByPath(map, "key1[0]")); map = N.asMap("key1", N.asSet("val1")); assertEquals("val1", Maps.getByPath(map, "key1[0]")); map = N.asMap("key1", N.asList(N.asLinkedHashSet("val1", "val2"))); assertEquals("val2", Maps.getByPath(map, "key1[0][1]")); map = N.asMap("key1", N.asSet(N.asList(N.asSet("val1")))); assertEquals("val1", Maps.getByPath(map, "key1[0][0][0]")); map = N.asMap("key1", N.asList(N.asLinkedHashSet("val1", N.asMap("key2", "val22")))); assertEquals("val22", Maps.getByPath(map, "key1[0][1].key2")); map = N.asMap("key1", N.asList(N.asLinkedHashSet("val1", N.asMap("key2", N.asList("val22", N.asMap("key3", "val33")))))); assertEquals("val33", Maps.getByPath(map, "key1[0][1].key2[1].key3")); map = N.asMap("key1", N.asList(N.asLinkedHashSet("val1", N.asMap("key2", N.asList("val22", N.asMap("key3", "val33")))))); assertNull(Maps.getByPath(map, "key1[0][2].key2[1].key3"));
- Type Parameters:
T
-- Parameters:
map
-path
-- Returns:
null
if there is no value found by the specified path.
-
getByPath
@MayReturnNull public static <T> T getByPath(Map<?, ?> map, String path, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
map
-path
-targetType
-- Returns:
null
if there is no value found by the specified path.
-
getByPathOrDefault
- Type Parameters:
T
-- Parameters:
map
-path
-defaultValue
-- Returns:
defaultValue
if there is no value found by the specified path.- See Also:
-
getByPathIfPresent
- Type Parameters:
T
-- Parameters:
map
-path
-- Returns:
- an empty
Nullable
if there is no value found by the specified path.
-
getByPathIfPresent
public static <T> u.Nullable<T> getByPathIfPresent(Map<?, ?> map, String path, Class<? extends T> targetType) - Type Parameters:
T
-- Parameters:
map
-path
-targetType
-- Returns:
- an empty
Nullable
if there is no value found by the specified path.
-
contains
Check if the specifiedMap
contains the specifiedEntry
.- Parameters:
map
-entry
-- Returns:
-
contains
- Parameters:
map
-key
-value
-- Returns:
-
intersection
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-map2
-- Returns:
-
difference
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-map2
-- Returns:
-
symmetricDifference
public static <K,V> Map<K,Pair<u.Nullable<V>, symmetricDifferenceu.Nullable<V>>> (Map<K, V> map, Map<K, V> map2) - Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-map2
-- Returns:
-
putIfAbsent
Put if absent.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-key
-value
-- Returns:
-
putIfAbsent
Put if absent.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-key
-supplier
-- Returns:
-
remove
Removes the specified entry.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-entry
-- Returns:
-
remove
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-key
-value
-- Returns:
-
removeKeys
Removes the keys.- Parameters:
map
-keysToRemove
-- Returns:
true
if any key/value was removed, otherwisefalse
.
-
removeEntries
The the entries from the specifiedMap
.- Parameters:
map
-entriesToRemove
-- Returns:
true
if any key/value was removed, otherwisefalse
.
-
removeIf
public static <K,V, boolean removeIfE extends Exception> (Map<K, V> map, Throwables.Predicate<? super Map.Entry<K, throws EV>, E> filter) Removes entries from the specifiedmap
by the the specifiedfilter
.- Type Parameters:
K
- the key typeV
- the value typeE
-- Parameters:
map
-filter
-- Returns:
true
if there are one or more than one entries removed from the specified map.- Throws:
E
- the e
-
removeIfKey
public static <K,V, boolean removeIfKeyE extends Exception> (Map<K, V> map, Throwables.Predicate<? super K, throws EE> filter) Removes entries from the specifiedmap
by the the specifiedfilter
.- Type Parameters:
K
- the key typeV
- the value typeE
-- Parameters:
map
-filter
-- Returns:
true
if there are one or more than one entries removed from the specified map.- Throws:
E
- the e
-
removeIfValue
public static <K,V, boolean removeIfValueE extends Exception> (Map<K, V> map, Throwables.Predicate<? super V, throws EE> filter) Removes entries from the specifiedmap
by the the specifiedfilter
.- Type Parameters:
K
- the key typeV
- the value typeE
-- Parameters:
map
-filter
-- Returns:
true
if there are one or more than one entries removed from the specified map.- Throws:
E
- the e
-
replace
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-key
-oldValue
-newValue
-- Returns:
-
replace
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-key
-newValue
-- Returns:
null
if(N.isEmpty(map))
. (auto-generated java doc for return)
-
replaceAll
public static <K,V, void replaceAllE extends Exception> (Map<K, V> map, Throwables.BiFunction<? super K, throws E? super V, ? extends V, E> function) - Type Parameters:
K
- the key typeV
- the value typeE
-- Parameters:
map
-function
-- Throws:
E
- the e
-
filter
public static <K,V, Map<K,E extends Exception> V> filter(Map<K, V> map, Throwables.BiPredicate<? super K, throws E? super V, E> predicate) - Type Parameters:
K
- the key typeV
- the value typeE
-- Parameters:
map
-predicate
-- Returns:
- Throws:
E
- the e
-
filterByKey
public static <K,V, Map<K,E extends Exception> V> filterByKey(Map<K, V> map, Throwables.Predicate<? super K, throws EE> predicate) Filter by key.- Type Parameters:
K
- the key typeV
- the value typeE
-- Parameters:
map
-predicate
-- Returns:
- Throws:
E
- the e
-
filterByValue
public static <K,V, Map<K,E extends Exception> V> filterByValue(Map<K, V> map, Throwables.Predicate<? super V, throws EE> predicate) Filter by value.- Type Parameters:
K
- the key typeV
- the value typeE
-- Parameters:
map
-predicate
-- Returns:
- Throws:
E
- the e
-
invert
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-- Returns:
- See Also:
-
Multimap#invertFrom(Map, Supplier)
ListMultimap#invertFrom(Map)
ListMultimap#invertFrom(Map)
-
invert
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-mergeOp
-- Returns:
-
flatInvert
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-- Returns:
- See Also:
-
Multimap#flatInvertFrom(Map, Supplier)
ListMultimap#flatInvertFrom(Map)
SetMultimap#flatInvertFrom(Map)
-
flatToMap
{a=[1, 2, 3], b=[4, 5, 6], c=[7, 8]} -> [{a=1, b=4, c=7}, {a=2, b=5, c=8}, {a=3, b=6}].- Type Parameters:
K
-V
-- Parameters:
map
-- Returns:
-
flatten
- Parameters:
map
-- Returns:
-
flatten
public static <M extends Map<String,Object>> M flatten(Map<String, Object> map, Supplier<? extends M> mapSupplier) - Type Parameters:
M
-- Parameters:
map
-mapSupplier
-- Returns:
-
flatten
public static <M extends Map<String,Object>> M flatten(Map<String, Object> map, String delimiter, Supplier<? extends M> mapSupplier) - Type Parameters:
M
-- Parameters:
map
-delimiter
-mapSupplier
-- Returns:
-
unflatten
- Parameters:
map
-- Returns:
-
unflatten
public static <M extends Map<String,Object>> M unflatten(Map<String, Object> map, Supplier<? extends M> mapSupplier) - Type Parameters:
M
-- Parameters:
map
-mapSupplier
-- Returns:
-
unflatten
public static <M extends Map<String,Object>> M unflatten(Map<String, Object> map, String delimiter, Supplier<? extends M> mapSupplier) - Type Parameters:
M
-- Parameters:
map
-delimiter
-mapSupplier
-- Returns:
-
merge
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-key
-value
-remappingFunction
-
-
map2Bean
Map to bean.- Type Parameters:
T
-- Parameters:
m
-targetClass
-- Returns:
-
map2Bean
@MayReturnNull public static <T> T map2Bean(Map<String, Object> m, boolean ignoreNullProperty, boolean ignoreUnmatchedProperty, Class<? extends T> targetClass) Map to bean.- Type Parameters:
T
-- Parameters:
m
-ignoreNullProperty
-ignoreUnmatchedProperty
-targetClass
-- Returns:
null
if(m == null)
. (auto-generated java doc for return)
-
map2Bean
@MayReturnNull public static <T> T map2Bean(Map<String, Object> m, Collection<String> selectPropNames, Class<? extends T> targetClass) Map to bean.- Type Parameters:
T
-- Parameters:
m
-selectPropNames
-targetClass
-- Returns:
null
if(m == null)
. (auto-generated java doc for return)
-
map2Bean
public static <T> List<T> map2Bean(Collection<Map<String, Object>> mList, Class<? extends T> targetClass) Map to bean.- Type Parameters:
T
-- Parameters:
mList
-targetClass
-- Returns:
-
map2Bean
public static <T> List<T> map2Bean(Collection<Map<String, Object>> mList, boolean igoreNullProperty, boolean ignoreUnmatchedProperty, Class<? extends T> targetClass) Map to bean.- Type Parameters:
T
-- Parameters:
mList
-igoreNullProperty
-ignoreUnmatchedProperty
-targetClass
-- Returns:
-
map2Bean
public static <T> List<T> map2Bean(Collection<Map<String, Object>> mList, Collection<String> selectPropNames, Class<? extends T> targetClass) Map to bean.- Type Parameters:
T
-- Parameters:
mList
-selectPropNames
-targetClass
-- Returns:
-
bean2Map
Bean to map.- Parameters:
bean
-- Returns:
-
bean2Map
public static <M extends Map<String,Object>> M bean2Map(Object bean, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-mapSupplier
-- Returns:
-
bean2Map
Bean to map.- Parameters:
bean
-selectPropNames
-- Returns:
-
bean2Map
public static <M extends Map<String,Object>> M bean2Map(Object bean, Collection<String> selectPropNames, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-selectPropNames
-mapSupplier
-- Returns:
-
bean2Map
public static <M extends Map<String,Object>> M bean2Map(Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-selectPropNames
-keyNamingPolicy
-mapSupplier
-- Returns:
-
bean2Map
Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-- Returns:
-
bean2Map
public static <M extends Map<String,Object>> M bean2Map(M resultMap, Object bean, Collection<String> selectPropNames) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-selectPropNames
-- Returns:
-
bean2Map
public static <M extends Map<String,Object>> M bean2Map(M resultMap, Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-selectPropNames
-keyNamingPolicy
-- Returns:
-
bean2Map
Bean to map.- Parameters:
bean
-ignoreNullProperty
-- Returns:
-
bean2Map
public static Map<String,Object> bean2Map(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames) Bean to map.- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-- Returns:
-
bean2Map
public static <M extends Map<String,Object>> M bean2Map(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-mapSupplier
-- Returns:
-
bean2Map
public static Map<String,Object> bean2Map(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-keyNamingPolicy
-- Returns:
-
bean2Map
public static <M extends Map<String,Object>> M bean2Map(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-keyNamingPolicy
-mapSupplier
-- Returns:
-
bean2Map
public static <M extends Map<String,Object>> M bean2Map(M resultMap, Object bean, boolean ignoreNullProperty) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-ignoreNullProperty
-- Returns:
-
bean2Map
public static <M extends Map<String,Object>> M bean2Map(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-ignoreNullProperty
-ignoredPropNames
-- Returns:
-
bean2Map
public static <M extends Map<String,Object>> M bean2Map(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-ignoreNullProperty
-ignoredPropNames
-keyNamingPolicy
-- Returns:
-
deepBean2Map
Bean to map.- Parameters:
bean
-- Returns:
-
deepBean2Map
public static <M extends Map<String,Object>> M deepBean2Map(Object bean, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-mapSupplier
-- Returns:
-
deepBean2Map
Bean to map.- Parameters:
bean
-selectPropNames
-- Returns:
-
deepBean2Map
public static <M extends Map<String,Object>> M deepBean2Map(Object bean, Collection<String> selectPropNames, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-selectPropNames
-mapSupplier
-- Returns:
-
deepBean2Map
public static <M extends Map<String,Object>> M deepBean2Map(Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-selectPropNames
-keyNamingPolicy
-mapSupplier
-- Returns:
-
deepBean2Map
Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-- Returns:
-
deepBean2Map
public static <M extends Map<String,Object>> M deepBean2Map(M resultMap, Object bean, Collection<String> selectPropNames) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-selectPropNames
-- Returns:
-
deepBean2Map
public static <M extends Map<String,Object>> M deepBean2Map(M resultMap, Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-selectPropNames
-keyNamingPolicy
-- Returns:
-
deepBean2Map
Bean to map.- Parameters:
bean
-ignoreNullProperty
-- Returns:
-
deepBean2Map
public static Map<String,Object> deepBean2Map(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames) Bean to map.- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-- Returns:
-
deepBean2Map
public static <M extends Map<String,Object>> M deepBean2Map(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-mapSupplier
-- Returns:
-
deepBean2Map
public static Map<String,Object> deepBean2Map(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-keyNamingPolicy
-- Returns:
-
deepBean2Map
public static <M extends Map<String,Object>> M deepBean2Map(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-keyNamingPolicy
-mapSupplier
-- Returns:
-
deepBean2Map
public static <M extends Map<String,Object>> M deepBean2Map(M resultMap, Object bean, boolean ignoreNullProperty) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-ignoreNullProperty
-- Returns:
-
deepBean2Map
public static <M extends Map<String,Object>> M deepBean2Map(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-ignoreNullProperty
-ignoredPropNames
-- Returns:
-
deepBean2Map
public static <M extends Map<String,Object>> M deepBean2Map(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-ignoreNullProperty
-ignoredPropNames
-keyNamingPolicy
-- Returns:
-
bean2FlatMap
Bean to map.- Parameters:
bean
-- Returns:
-
bean2FlatMap
public static <M extends Map<String,Object>> M bean2FlatMap(Object bean, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-mapSupplier
-- Returns:
-
bean2FlatMap
Bean to map.- Parameters:
bean
-selectPropNames
-- Returns:
-
bean2FlatMap
public static <M extends Map<String,Object>> M bean2FlatMap(Object bean, Collection<String> selectPropNames, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-selectPropNames
-mapSupplier
-- Returns:
-
bean2FlatMap
public static <M extends Map<String,Object>> M bean2FlatMap(Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-selectPropNames
-keyNamingPolicy
-mapSupplier
-- Returns:
-
bean2FlatMap
Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-- Returns:
-
bean2FlatMap
public static <M extends Map<String,Object>> M bean2FlatMap(M resultMap, Object bean, Collection<String> selectPropNames) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-selectPropNames
-- Returns:
-
bean2FlatMap
public static <M extends Map<String,Object>> M bean2FlatMap(M resultMap, Object bean, Collection<String> selectPropNames, NamingPolicy keyNamingPolicy) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-selectPropNames
-keyNamingPolicy
-- Returns:
-
bean2FlatMap
Bean to map.- Parameters:
bean
-ignoreNullProperty
-- Returns:
-
bean2FlatMap
public static Map<String,Object> bean2FlatMap(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames) Bean to map.- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-- Returns:
-
bean2FlatMap
public static <M extends Map<String,Object>> M bean2FlatMap(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-mapSupplier
-- Returns:
-
bean2FlatMap
public static Map<String,Object> bean2FlatMap(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-keyNamingPolicy
-- Returns:
-
bean2FlatMap
public static <M extends Map<String,Object>> M bean2FlatMap(Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy, IntFunction<? extends M> mapSupplier) Bean to map.- Type Parameters:
M
-- Parameters:
bean
-ignoreNullProperty
-ignoredPropNames
-keyNamingPolicy
-mapSupplier
-- Returns:
-
bean2FlatMap
public static <M extends Map<String,Object>> M bean2FlatMap(M resultMap, Object bean, boolean ignoreNullProperty) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-ignoreNullProperty
-- Returns:
-
bean2FlatMap
public static <M extends Map<String,Object>> M bean2FlatMap(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-ignoreNullProperty
-ignoredPropNames
-- Returns:
-
bean2FlatMap
public static <M extends Map<String,Object>> M bean2FlatMap(M resultMap, Object bean, boolean ignoreNullProperty, Set<String> ignoredPropNames, NamingPolicy keyNamingPolicy) Bean to map.- Type Parameters:
M
-- Parameters:
resultMap
-bean
-ignoreNullProperty
-ignoredPropNames
-keyNamingPolicy
-- Returns:
-
CommonUtil.newEntry(Object, Object)