Author: tv
Date: Wed Jul 27 12:25:53 2016
New Revision: 1754258

URL: http://svn.apache.org/viewvc?rev=1754258&view=rev
Log:
Fix: Remove commons-collections dependency

Modified:
    
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ListOrderedMapCI.java

Modified: 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ListOrderedMapCI.java
URL: 
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ListOrderedMapCI.java?rev=1754258&r1=1754257&r2=1754258&view=diff
==============================================================================
--- 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ListOrderedMapCI.java
 (original)
+++ 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ListOrderedMapCI.java
 Wed Jul 27 12:25:53 2016
@@ -19,25 +19,65 @@ package org.apache.torque.util;
  * under the License.
  */
 
-import java.util.TreeMap;
+import java.util.LinkedHashMap;
 
 /**
- * A subclass of TreeMap that has case insensitive
+ * A subclass of LinkedHashMap that has case insensitive
  * String key methods.
  *
  * @author <a href="mailto:greg.mon...@dukece.com";>Greg Monroe</a>
  * @version $Id$
  */
-public class ListOrderedMapCI<T> extends TreeMap<String, T>
+public class ListOrderedMapCI<T> extends LinkedHashMap<String, T>
 {
     /** Version id for serializing. */
     private static final long serialVersionUID = -4349246328751938554L;
 
     /**
-     * Constructs a new empty ListOrderedMap.
+     * Get the object associated with this key.
+     *
+     * @param key A case insensitive String.
+     * @return The value for this key
      */
-    public ListOrderedMapCI()
+    @Override
+    public T get(Object key)
     {
-        super(String.CASE_INSENSITIVE_ORDER);
+       return super.get(((String) key).toLowerCase());
+    }
+
+    /**
+     * Adds a value to the end of the list with the specified key.
+     *
+     * @param key A case insensitive String.
+     * @param value The value to add
+     * @return The value for previously mapped to this key
+     */
+    @Override
+    public T put(String key, T value)
+    {
+        return super.put(key.toLowerCase(), value);
+    }
+
+    /**
+     * Removes the mapping for the specified key.
+     * @param key A case insensitive String.
+     * @return the removed value, or null if none existed
+     */
+    @Override
+    public T remove (Object key)
+    {
+        return super.remove(((String) key).toLowerCase());
+    }
+
+    /**
+     * Test if the key exists in the mapping.
+     *
+     * @param key The case insensitive key to test for.
+     * @return True if the key exists.
+     */
+    @Override
+    public boolean containsKey(Object key)
+    {
+        return super.containsKey(((String) key).toLowerCase());
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org
For additional commands, e-mail: torque-dev-h...@db.apache.org

Reply via email to