From cd5a0762b99d8c59fab9528bb28210893a73d022 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Mon, 30 Mar 2009 14:32:39 +0000
Subject: [PATCH] LMS-787 Add remove() method

SVN: 10472
---
 .../cisd/common/collections/TableMap.java        | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/common/source/java/ch/systemsx/cisd/common/collections/TableMap.java b/common/source/java/ch/systemsx/cisd/common/collections/TableMap.java
index fc0f06d1ccf..2752ec4294f 100644
--- a/common/source/java/ch/systemsx/cisd/common/collections/TableMap.java
+++ b/common/source/java/ch/systemsx/cisd/common/collections/TableMap.java
@@ -189,6 +189,22 @@ public class TableMap<K, E> implements Iterable<E>
     {
         return Collections.unmodifiableSet(map.keySet());
     }
+    
+    /**
+     * Removes and returns the row for the specified key.
+     * 
+     * @return stored row.
+     */
+    public E remove(K key)
+    {
+        E row = map.remove(key);
+        if (row == null)
+        {
+            throw new IllegalArgumentException("Couldn't remove row for key '" + key
+                    + "' because there was no row.");
+        }
+        return row;
+    }
 
     //
     // Object
-- 
GitLab