Package com.cedarsoftware.util
Class CompactCIHashMap<K,V>
java.lang.Object
com.cedarsoftware.util.CompactMap<K,V>
com.cedarsoftware.util.CompactCIHashMap<K,V>
- Type Parameters:
K
- the type of keys maintained by this mapV
- the type of mapped values
- All Implemented Interfaces:
Map<K,
V>
A case-insensitive Map implementation that uses a compact internal representation
for small maps. This Map exists to simplify JSON serialization. No custom reader nor
writer is needed to serialize this map. It is a drop-in replacement for HashMap if
you want case-insensitive behavior for String keys and compactness.
This creates a CompactMap with:
- compactSize = 40 (same as CompactCIHashMap)
- caseSensitive = false (case-insensitive behavior)
- ordering = UNORDERED (standard HashMap behavior)
- Author:
- John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
License
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.cedarsoftware.util.CompactMap
CompactMap.Builder<K,
V>, CompactMap.CompactMapComparator, CompactMap.CompactMapEntry, CompactMap.LogicalValueType -
Field Summary
Fields inherited from class com.cedarsoftware.util.CompactMap
CASE_SENSITIVE, COMPACT_SIZE, DEFAULT_CASE_SENSITIVE, DEFAULT_COMPACT_SIZE, DEFAULT_MAP_TYPE, DEFAULT_SINGLE_KEY, INSERTION, MAP_TYPE, ORDERING, REVERSE, SINGLE_KEY, SORTED, SOURCE_MAP, UNORDERED, val
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates the backing map instance when size exceeds compactSize.protected boolean
Determines if String keys are compared case-insensitively.protected boolean
Methods inherited from class com.cedarsoftware.util.CompactMap
builder, clear, compactSize, computeKeyHashCode, computeValueHashCode, containsKey, containsValue, entrySet, equals, get, getConfig, getLogicalValueType, getOrdering, getSingleValueKey, hashCode, isDefaultCompactMap, isEmpty, keySet, minus, plus, put, putAll, remove, size, toString, values, withConfig
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
CompactCIHashMap
public CompactCIHashMap() -
CompactCIHashMap
-
-
Method Details
-
getNewMap
Description copied from class:CompactMap
Creates the backing map instance when size exceeds compactSize.Default implementation returns HashMap. Override to provide different map implementation (e.g., TreeMap for sorted maps, LinkedHashMap for insertion ordered maps).
- Overrides:
getNewMap
in classCompactMap<K,
V> - Returns:
- new empty map instance for backing storage
-
isCaseInsensitive
protected boolean isCaseInsensitive()Description copied from class:CompactMap
Determines if String keys are compared case-insensitively.Default implementation returns false (case-sensitive). Override to change String key comparison behavior. Affects key equality and sorting.
- Overrides:
isCaseInsensitive
in classCompactMap<K,
V> - Returns:
- true if String keys should be compared ignoring case, false otherwise
-
useCopyIterator
protected boolean useCopyIterator()
-