UIMA-5306
- fix wrong usage of remove

git-svn-id: https://svn.apache.org/repos/asf/uima/ruta/branches/RutaBasicMemory@1784707 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ruta-typesystem/src/main/java/org/apache/uima/ruta/type/RutaBasic.java b/ruta-typesystem/src/main/java/org/apache/uima/ruta/type/RutaBasic.java
index 6cd6f45..f6bd954 100644
--- a/ruta-typesystem/src/main/java/org/apache/uima/ruta/type/RutaBasic.java
+++ b/ruta-typesystem/src/main/java/org/apache/uima/ruta/type/RutaBasic.java
@@ -293,7 +293,8 @@
     int code = ((TypeImpl) type).getCode();
     IntArrayList list = beginMap.get(code);
     if (list != null) {
-      list.removeInt(annotationToAddress(annotation));
+      int indexOf = list.indexOf(annotationToAddress(annotation));
+      list.removeInt(indexOf);
       if (list.isEmpty()) {
         beginMap.remove(code);
       }
@@ -314,7 +315,8 @@
     int code = ((TypeImpl) type).getCode();
     IntArrayList list = endMap.get(code);
     if (list != null) {
-      list.removeInt(annotationToAddress(annotation));
+      int indexOf = list.indexOf(annotationToAddress(annotation));
+      list.removeInt(indexOf);
       if (list.isEmpty()) {
         endMap.remove(code);
       }
diff --git a/ruta-typesystem/src/main/java/org/apache/uima/ruta/type/RutaBasic4.java b/ruta-typesystem/src/main/java/org/apache/uima/ruta/type/RutaBasic4.java
index aefd282..66e6a26 100644
--- a/ruta-typesystem/src/main/java/org/apache/uima/ruta/type/RutaBasic4.java
+++ b/ruta-typesystem/src/main/java/org/apache/uima/ruta/type/RutaBasic4.java
@@ -293,7 +293,8 @@
     int code = ((TypeImpl) type).getCode();
     IntArrayList list = beginMap.get(code);
     if (list != null) {
-      list.removeInt(annotationToAddress(annotation));
+      int indexOf = list.indexOf(annotationToAddress(annotation));
+      list.removeInt(indexOf);
       if (list.isEmpty()) {
         beginMap.remove(code);
       }
@@ -314,7 +315,8 @@
     int code = ((TypeImpl) type).getCode();
     IntArrayList list = endMap.get(code);
     if (list != null) {
-      list.removeInt(annotationToAddress(annotation));
+      int indexOf = list.indexOf(annotationToAddress(annotation));
+      list.removeInt(indexOf);
       if (list.isEmpty()) {
         endMap.remove(code);
       }