ikrs.util
Class FileExtensionKeyMap<V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.TreeMap<java.lang.String,V>
          extended by ikrs.util.FileExtensionKeyMap<V>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,V>, java.util.NavigableMap<java.lang.String,V>, java.util.SortedMap<java.lang.String,V>

public class FileExtensionKeyMap<V>
extends java.util.TreeMap<java.lang.String,V>

As there is a small issue mapping file extensions in different styles; if you store a file extension ".txt" to this map (key) looking up ".TXT" or "txt" won't retrieve the mapped value if using a regular String orientated map. This map uses a case-insensitive key comparator (so ".txt" and ".TXT" are the same) and handles the preceding dot "." (so ".txt" and "txt" are the same). Both settings are optional.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
FileExtensionKeyMap()
           
FileExtensionKeyMap(boolean isStrict, boolean isCaseSensitive)
           
 
Method Summary
 V get(java.lang.Object fileExtension)
          This method overrides TreeMap.get(String) to adapt the file extension mapping.
protected  V get(java.lang.String fileExtension)
          This method tries to resolve multiple meanings of the file extension.
static void main(java.lang.String[] argv)
          For testing only.
 
Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, remove, size, subMap, subMap, tailMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Constructor Detail

FileExtensionKeyMap

public FileExtensionKeyMap()

FileExtensionKeyMap

public FileExtensionKeyMap(boolean isStrict,
                           boolean isCaseSensitive)
Method Detail

get

public V get(java.lang.Object fileExtension)
This method overrides TreeMap.get(String) to adapt the file extension mapping.

Specified by:
get in interface java.util.Map<java.lang.String,V>
Overrides:
get in class java.util.TreeMap<java.lang.String,V>

get

protected V get(java.lang.String fileExtension)
This method tries to resolve multiple meanings of the file extension.


main

public static void main(java.lang.String[] argv)
For testing only.