Top Description Inners Fields Constructors Methods
org.apache.sshd.common.util

public final Class MapEntryUtils

extends Object
Class Inheritance
Imports
java.util.Arrays, .Collection, .Collections, .Comparator, .EnumMap, .LinkedHashMap, .Map, .NavigableMap, .Objects, .TreeMap, java.util.function.BinaryOperator, .Function, .Supplier, java.util.stream.Collector, .Collectors

Represents an un-modifiable pair of values
Author
Apache MINA SSHD Project

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
MapEntryUtils.GenericMapPopulator<K, V, M extends Map<K, V>>

public static class

Field Summary

Modifier and TypeField and Description
private static final Comparator<Map.Entry<Comparable<T>, ?>>
private static final Supplier<T>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <
The Comparable key type
K extends Comparable<K>
,
The associated entry value
V
>
Comparator<Map.Entry<K, V>>

Returns:

A Comparator for java.util.Map.Entry-ies that compares the key values
byKeyEntryComparator
()

public static <
Type of mapped value
V
>
Supplier<NavigableMap<String, V>>

Returns:

A Supplier that returns a new NavigableMap whenever its get() method is invoked
caseInsensitiveMap
()

public static <
Original map key type
K
,
Original map value type
V
,
Flipped map type
M extends Map<V, K>
>
M

Returns:

The flipped map result
flipMap
(Map<? extends K, ? extends V>
The original map to flip
map
,
Supplier<? extends M>
The creator of the target map
mapCreator
,
boolean
Whether to ignore duplicates on flip
allowDuplicates
)

Flips between keys and values of an input map

public static boolean
isEmpty(Map<?, ?> m)

public static boolean
isNotEmpty(Map<?, ?> m)

public static <K, V, M extends Map<K, V>> M
mapValues(Function<? super V, ? extends K> keyMapper, Supplier<? extends M> mapCreator, V... values)

public static <
The key type
K
,
The value type
V
,
The result Map type
M extends Map<K, V>
>
M

Returns:

The resulting Map - Note: no validation is made to ensure that 2 (or more) values are not mapped to the same key
mapValues
(Function<? super V, ? extends K>
The Function that generates a key for a given value. If the returned key is null then the value is not mapped
keyMapper
,
Supplier<? extends M>
The Supplier used to create/retrieve the result map - provided non-empty group of values
mapCreator
,
Collection<? extends V>
The values to be mapped
values
)

Creates a map out of a group of values

public static int
size(Map<?, ?> m)

public static <T> BinaryOperator<T>
public static <T, K, U> NavigableMap<K, U>
toSortedMap(Iterable<? extends T> values, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends U> valueMapper, Comparator<? super K> comparator)

public static <T, K, U> Collector<T, ?, NavigableMap<K, U>>
toSortedMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends U> valueMapper, Comparator<? super K> comparator)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BY_KEY_COMPARATORback to summary
private static final Comparator<Map.Entry<Comparable<T>, ?>> BY_KEY_COMPARATOR
Annotations
@SuppressWarnings:rawtypes, unchecked
CASE_INSENSITIVE_MAP_FACTORYback to summary
private static final Supplier<T> CASE_INSENSITIVE_MAP_FACTORY
Annotations
@SuppressWarnings:rawtypes

Constructor Detail

MapEntryUtilsback to summary
private MapEntryUtils()

Method Detail

byKeyEntryComparatorback to summary
public static <K extends Comparable<K>, V> Comparator<Map.Entry<K, V>> byKeyEntryComparator()
Parameters
<K>
The Comparable key type
<V>
The associated entry value
Returns:Comparator<Map.Entry<K, V>>

A Comparator for java.util.Map.Entry-ies that compares the key values

Annotations
@SuppressWarnings:unchecked, rawtypes
caseInsensitiveMapback to summary
public static <V> Supplier<NavigableMap<String, V>> caseInsensitiveMap()
Parameters
<V>
Type of mapped value
Returns:Supplier<NavigableMap<String, V>>

A Supplier that returns a new NavigableMap whenever its get() method is invoked

Annotations
@SuppressWarnings:unchecked
flipMapback to summary
public static <K, V, M extends Map<V, K>> M flipMap(Map<? extends K, ? extends V> map, Supplier<? extends M> mapCreator, boolean allowDuplicates)

Flips between keys and values of an input map

Parameters
<K>
Original map key type
<V>
Original map value type
<M>
Flipped map type
map:Map<? extends K, ? extends V>

The original map to flip

mapCreator:Supplier<? extends M>

The creator of the target map

allowDuplicates:boolean

Whether to ignore duplicates on flip

Returns:M

The flipped map result

Exceptions
IllegalArgumentException:
if allowDuplicates is false and a duplicate value found in the original map.
isEmptyback to summary
public static boolean isEmpty(Map<?, ?> m)
isNotEmptyback to summary
public static boolean isNotEmpty(Map<?, ?> m)
mapValuesback to summary
public static <K, V, M extends Map<K, V>> M mapValues(Function<? super V, ? extends K> keyMapper, Supplier<? extends M> mapCreator, V... values)
Annotations
@SafeVarargs
mapValuesback to summary
public static <K, V, M extends Map<K, V>> M mapValues(Function<? super V, ? extends K> keyMapper, Supplier<? extends M> mapCreator, Collection<? extends V> values)

Creates a map out of a group of values

Parameters
<K>
The key type
<V>
The value type
<M>
The result Map type
keyMapper:Function<? super V, ? extends K>

The Function that generates a key for a given value. If the returned key is null then the value is not mapped

mapCreator:Supplier<? extends M>

The Supplier used to create/retrieve the result map - provided non-empty group of values

values:Collection<? extends V>

The values to be mapped

Returns:M

The resulting Map - Note: no validation is made to ensure that 2 (or more) values are not mapped to the same key

sizeback to summary
public static int size(Map<?, ?> m)
throwingMergerback to summary
public static <T> BinaryOperator<T> throwingMerger()
toSortedMapback to summary
public static <T, K, U> NavigableMap<K, U> toSortedMap(Iterable<? extends T> values, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends U> valueMapper, Comparator<? super K> comparator)
toSortedMapback to summary
public static <T, K, U> Collector<T, ?, NavigableMap<K, U>> toSortedMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends U> valueMapper, Comparator<? super K> comparator)
org.apache.sshd.common.util back to summary

public Class MapEntryUtils.EnumMapBuilder<K extends Enum<K>, V>

extends MapEntryUtils.GenericMapPopulator<K extends Enum<K>, V, Map<K extends Enum<K>, V>>
Class Inheritance

Constructor Summary

AccessConstructor and Description
public
EnumMapBuilder(Class<K> keyType)

Method Summary

Modifier and TypeMethod and Description
public Map<K, V>
public static <K extends Enum<K>, V> MapEntryUtils.EnumMapBuilder<K, V>
builder(Class<K> keyType)

public MapEntryUtils.EnumMapBuilder<K, V>
public Map<K, V>
public MapEntryUtils.EnumMapBuilder<K, V>
public MapEntryUtils.EnumMapBuilder<K, V>
public MapEntryUtils.EnumMapBuilder<K, V>
Inherited from org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator:
get

Constructor Detail

EnumMapBuilderback to summary
public EnumMapBuilder(Class<K> keyType)

Method Detail

buildback to summary
public Map<K, V> build()
builderback to summary
public static <K extends Enum<K>, V> MapEntryUtils.EnumMapBuilder<K, V> builder(Class<K> keyType)
clearback to summary
public MapEntryUtils.EnumMapBuilder<K, V> clear()

Overrides org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator.clear.

Annotations
@Override
immutableback to summary
public Map<K, V> immutable()
putback to summary
public MapEntryUtils.EnumMapBuilder<K, V> put(K k, V v)

Overrides org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator.put.

Annotations
@Override
putAllback to summary
public MapEntryUtils.EnumMapBuilder<K, V> putAll(Map<? extends K, ? extends V> other)

Overrides org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator.putAll.

Annotations
@Override
removeback to summary
public MapEntryUtils.EnumMapBuilder<K, V> remove(K k)

Overrides org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator.remove.

Annotations
@Override
org.apache.sshd.common.util back to summary

public Class MapEntryUtils.GenericMapPopulator<K, V, M extends Map<K, V>>

extends Object
implements Supplier<M extends Map<K, V>>
Class Inheritance
  • java.lang.Object
  • org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator
All Implemented Interfaces
java.util.function.Supplier
Known Direct Subclasses
org.apache.sshd.common.util.MapEntryUtils.MapBuilder, org.apache.sshd.common.util.MapEntryUtils.NavigableMapBuilder, org.apache.sshd.common.util.MapEntryUtils.EnumMapBuilder

Field Summary

Modifier and TypeField and Description
private final M

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public MapEntryUtils.GenericMapPopulator<K, V, M>
public M
get()

Implements java.util.function.Supplier.get.

Gets a result.

public MapEntryUtils.GenericMapPopulator<K, V, M>
put(K k, V v)

public MapEntryUtils.GenericMapPopulator<K, V, M>
putAll(Map<? extends K, ? extends V> other)

public MapEntryUtils.GenericMapPopulator<K, V, M>
remove(K k)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapback to summary
private final M map

Constructor Detail

GenericMapPopulatorback to summary
public GenericMapPopulator(M map)

Method Detail

clearback to summary
public MapEntryUtils.GenericMapPopulator<K, V, M> clear()
getback to summary
public M get()

Implements java.util.function.Supplier.get.

Doc from java.util.function.Supplier.get.

Gets a result.

Returns:M

a result

Annotations
@Override
putback to summary
public MapEntryUtils.GenericMapPopulator<K, V, M> put(K k, V v)
putAllback to summary
public MapEntryUtils.GenericMapPopulator<K, V, M> putAll(Map<? extends K, ? extends V> other)
removeback to summary
public MapEntryUtils.GenericMapPopulator<K, V, M> remove(K k)
org.apache.sshd.common.util back to summary

public Class MapEntryUtils.MapBuilder<K, V>

extends MapEntryUtils.GenericMapPopulator<K, V, Map<K, V>>
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Map<K, V>
public static <K, V> MapEntryUtils.MapBuilder<K, V>
public MapEntryUtils.MapBuilder<K, V>
public Map<K, V>
public MapEntryUtils.MapBuilder<K, V>
public MapEntryUtils.MapBuilder<K, V>
public MapEntryUtils.MapBuilder<K, V>
Inherited from org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator:
get

Constructor Detail

MapBuilderback to summary
public MapBuilder()

Method Detail

buildback to summary
public Map<K, V> build()
builderback to summary
public static <K, V> MapEntryUtils.MapBuilder<K, V> builder()
clearback to summary
public MapEntryUtils.MapBuilder<K, V> clear()

Overrides org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator.clear.

Annotations
@Override
immutableback to summary
public Map<K, V> immutable()
putback to summary
public MapEntryUtils.MapBuilder<K, V> put(K k, V v)

Overrides org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator.put.

Annotations
@Override
putAllback to summary
public MapEntryUtils.MapBuilder<K, V> putAll(Map<? extends K, ? extends V> other)

Overrides org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator.putAll.

Annotations
@Override
removeback to summary
public MapEntryUtils.MapBuilder<K, V> remove(K k)

Overrides org.apache.sshd.common.util.MapEntryUtils.GenericMapPopulator.remove.

Annotations
@Override