From 4a08548070b8f63f75dc296173d91c72000d122f Mon Sep 17 00:00:00 2001 From: Mark Davis Date: Fri, 5 Sep 2014 14:45:21 +0000 Subject: [PATCH] ICU-11067 documented limitation on modification while iterating X-SVN-Rev: 36361 --- icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java | 4 ++++ .../core/src/com/ibm/icu/text/UnicodeSetIterator.java | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java b/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java index 7e44d8a2cc..ac2e891c5a 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java @@ -4132,6 +4132,8 @@ public class UnicodeSet extends UnicodeFilter implements Iterable, Compa * The UnicodeSet must not be altered during the iteration. * The EntryRange is the same each time; the contents are just reset.
* Warning: To iterate over the full contents, you have to also iterate over the strings. + *

Warning: For speed, UnicodeSet iteration does not check for concurrent modification. + * Do not alter the UnicodeSet while iterating. * *

      * // Sample code
@@ -4180,6 +4182,8 @@ public class UnicodeSet extends UnicodeFilter implements Iterable, Compa
 
     /**
      * Returns a string iterator. Uses the same order of iteration as {@link UnicodeSetIterator}.
+     * 

Warning: For speed, UnicodeSet iteration does not check for concurrent modification. + * Do not alter the UnicodeSet while iterating. * @see java.util.Set#iterator() * @stable ICU 4.4 */ diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSetIterator.java b/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSetIterator.java index 25463b74a4..cecfc44351 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSetIterator.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSetIterator.java @@ -32,6 +32,8 @@ import java.util.Iterator; * } * } *

+ *

Warning: For speed, UnicodeSet iteration does not check for concurrent modification. + * Do not alter the UnicodeSet while iterating. * @author M. Davis * @stable ICU 2.0 */ @@ -104,7 +106,8 @@ public class UnicodeSetIterator { * calls to next() and nextRange() without * calling reset() between them. The results of doing so * are undefined. - * + *

Warning: For speed, UnicodeSet iteration does not check for concurrent modification. + * Do not alter the UnicodeSet while iterating. * @return true if there was another element in the set and this * object contains the element. * @stable ICU 2.0