Package picocli
Class CommandLine.Model.CaseAwareLinkedMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- picocli.CommandLine.Model.CaseAwareLinkedMap<K,V>
-
- Type Parameters:
V
- type of the value
- All Implemented Interfaces:
java.util.Map<K,V>
- Enclosing class:
- CommandLine.Model
static class CommandLine.Model.CaseAwareLinkedMap<K,V> extends java.util.AbstractMap<K,V>
This class provides a case-aware Linked HashMap. Supports both case-sensitive and case-insensitive modes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
CommandLine.Model.CaseAwareLinkedMap.CaseAwareKeySet
-
Constructor Summary
Constructors Constructor Description CaseAwareLinkedMap()
Constructs an emptyCaseAwareLinkedMap
instance withLocale.ENGLISH
.CaseAwareLinkedMap(java.util.Locale locale)
Constructs an emptyCaseAwareLinkedMap
instance with the specifiedLocale
.CaseAwareLinkedMap(CommandLine.Model.CaseAwareLinkedMap<? extends K,? extends V> map)
Constructs aCaseAwareLinkedMap
instance with the same mappings, case-sensitivity and locale as the specified map.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
java.util.Set<java.util.Map.Entry<K,V>>
entrySet()
V
get(java.lang.Object key)
K
getCaseSensitiveKey(K caseInsensitiveKey)
Returns the case-sensitive key of the specified case-insensitive key ifisCaseSensitive()
.java.util.Locale
getLocale()
Returns the locale of the map.(package private) static boolean
isCaseConvertible(java.lang.Class<?> clazz)
boolean
isCaseInsensitive()
Returns the case-insensitivity of the map.java.util.Set<K>
keySet()
V
put(K key, V value)
V
remove(java.lang.Object key)
void
setCaseInsensitive(boolean caseInsensitive)
Sets the case-insensitivity of the map.int
size()
private K
toLowerCase(java.lang.Object caseSensitiveKey)
java.util.Collection<V>
values()
-
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, isEmpty, putAll, toString
-
-
-
-
Constructor Detail
-
CaseAwareLinkedMap
public CaseAwareLinkedMap()
Constructs an emptyCaseAwareLinkedMap
instance withLocale.ENGLISH
.
-
CaseAwareLinkedMap
public CaseAwareLinkedMap(java.util.Locale locale)
Constructs an emptyCaseAwareLinkedMap
instance with the specifiedLocale
.- Parameters:
locale
- the locale to convert character cases
-
CaseAwareLinkedMap
public CaseAwareLinkedMap(CommandLine.Model.CaseAwareLinkedMap<? extends K,? extends V> map)
Constructs aCaseAwareLinkedMap
instance with the same mappings, case-sensitivity and locale as the specified map.- Parameters:
map
- the map whose mappings, case-sensitivity and locale are to be placed in this map- Throws:
java.lang.NullPointerException
- if the specified map is null
-
-
Method Detail
-
isCaseConvertible
static boolean isCaseConvertible(java.lang.Class<?> clazz)
-
toLowerCase
private K toLowerCase(java.lang.Object caseSensitiveKey)
-
isCaseInsensitive
public boolean isCaseInsensitive()
Returns the case-insensitivity of the map.
-
setCaseInsensitive
public void setCaseInsensitive(boolean caseInsensitive)
Sets the case-insensitivity of the map.
-
getLocale
public java.util.Locale getLocale()
Returns the locale of the map.
-
getCaseSensitiveKey
public K getCaseSensitiveKey(K caseInsensitiveKey)
Returns the case-sensitive key of the specified case-insensitive key ifisCaseSensitive()
. Otherwise, the specified case-insensitive key is returned.
-
size
public int size()
-
containsKey
public boolean containsKey(java.lang.Object key)
-
containsValue
public boolean containsValue(java.lang.Object value)
-
get
public V get(java.lang.Object key)
-
remove
public V remove(java.lang.Object key)
-
clear
public void clear()
-
keySet
public java.util.Set<K> keySet()
-
values
public java.util.Collection<V> values()
-
-