Class StringPrefixMap<V>
java.lang.Object
org.wpilib.util.collections.prefixmap.StringPrefixMap<V>
- Type Parameters:
V- The type of the value that is to be stored.
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()The prefixmap will be empty after this call returns.booleancontainsKey(Object key) booleanReturnstrueif this map contains an exact mapping for the specified prefix.booleancontainsValue(Object value) entrySet()booleanReturn the value of theexactmatching prefix.Returns List of all matches that have a value.Return the value of the longest matching prefix.Return the value of theshortestmatching prefix.inthashCode()keySet()Stored the specified value as the result for the specified prefix.Removes the mapping for a prefix if present.intsize()Return the number of prefix-value mappings in this prefixmap.values()Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllMethods inherited from interface PrefixMap
containsPrefix, containsPrefix, get, getAllMatches, getAllMatches, getLongestMatch, getLongestMatch, getShortestMatch, getShortestMatch, isEmpty, putAll, remove
-
Constructor Details
-
StringPrefixMap
public StringPrefixMap()Constructor.
-
-
Method Details
-
containsPrefix
Description copied from interface:PrefixMapReturnstrueif this map contains an exact mapping for the specified prefix.- Specified by:
containsPrefixin interfacePrefixMap<V>- Parameters:
prefix- prefix whose presence in this prefixmap is to be checked- Returns:
trueif this map contains an the exact mapping for the specified prefix.
-
put
Description copied from interface:PrefixMapStored the specified value as the result for the specified prefix.If for the specified prefix previously a value was present then the old value is replaced with the new value and the old value is returned.
- Specified by:
putin interfaceMap<String,V> - Specified by:
putin interfacePrefixMap<V>- Parameters:
prefix- prefix with which the specified value is to be associatedvalue- value to be associated with the specified prefix- Returns:
- the previous value of the specified
prefix, ornullif there was no mapping forprefix.
-
size
-
clear
-
remove
Description copied from interface:PrefixMapRemoves the mapping for a prefix if present. -
get
Description copied from interface:PrefixMapReturn the value of theexactmatching prefix.The value returned is the stored prefix for which is true:
input.equals(prefix). -
getShortestMatch
Description copied from interface:PrefixMapReturn the value of theshortestmatching prefix.The value returned is the shortest stored prefix for which is true:
input.startsWith(prefix).- Specified by:
getShortestMatchin interfacePrefixMap<V>- Parameters:
input- The string (iterator of Unicode CodePoints) for which we need value of the stored prefix.- Returns:
- The value, null if not found.
-
getLongestMatch
Description copied from interface:PrefixMapReturn the value of the longest matching prefix.The value returned is the longest stored prefix for which is true:
input.startsWith(prefix).- Specified by:
getLongestMatchin interfacePrefixMap<V>- Parameters:
input- The string (iterator of Unicode CodePoints) for which we need value of the stored prefix.- Returns:
- The value, null if not found.
-
getAllMatches
Description copied from interface:PrefixMapReturns List of all matches that have a value.The list contains all non-null values for the prefix values where this is true:
input.startsWith(prefix).- Specified by:
getAllMatchesin interfacePrefixMap<V>- Parameters:
input- The string (iterator of Unicode CodePoints) for which we need value of the stored prefix.- Returns:
- The list of values, an empty List if nothing is found.
-
entrySet
-
containsKey
- Specified by:
containsKeyin interfaceMap<String,V> - Specified by:
containsKeyin interfacePrefixMap<V>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,V> - Specified by:
containsValuein interfacePrefixMap<V>
-
keySet
-
values
-
equals
-
hashCode
-