diff --git a/Examples/test-suite/java/li_std_list_runme.java b/Examples/test-suite/java/li_std_list_runme.java index 05be034ff..ca40db2f2 100644 --- a/Examples/test-suite/java/li_std_list_runme.java +++ b/Examples/test-suite/java/li_std_list_runme.java @@ -37,6 +37,22 @@ public class li_std_list_runme { if (v1.size() != 1) throw new RuntimeException("v1 test (7) failed"); if (v1.get(0) != 456) throw new RuntimeException("v1 test (8) failed"); + java.util.Iterator v1_iterator = v1.iterator(); + if (!v1_iterator.hasNext()) throw new RuntimeException("v1 test (9) failed"); + if (v1_iterator.next() != 456) throw new RuntimeException("v1 test (10) failed"); + if (v1_iterator.hasNext()) throw new RuntimeException("v1 test (11) failed"); + try { + v1_iterator.next(); + throw new RuntimeException("v1 test (12) failed"); + } catch (java.util.NoSuchElementException e) { + } + + if (v1.remove(new Integer(123))) throw new RuntimeException("v1 test (13) failed"); + if (!v1.remove(new Integer(456))) throw new RuntimeException("v1 test (14) failed"); + if (!v1.isEmpty()) throw new RuntimeException("v1 test (15) failed"); + if (v1.size() != 0) throw new RuntimeException("v1 test (16) failed"); + if (v1.remove(new Integer(456))) throw new RuntimeException("v1 test (17) failed"); + StructList v4 = new StructList(); StructPtrList v5 = new StructPtrList(); StructConstPtrList v6 = new StructConstPtrList(); diff --git a/Lib/java/std_list.i b/Lib/java/std_list.i index ab824e512..0eca5a970 100644 --- a/Lib/java/std_list.i +++ b/Lib/java/std_list.i @@ -165,6 +165,8 @@ namespace std { %rename(isEmpty) empty; bool empty() const; void clear(); + %rename(remove) erase; + iterator erase(iterator pos); size_type max_size() const; void pop_back(); void pop_front();