1. vector.contains() uses sequential comparison, O(n).
As the vector size is great, the performance will be impacted.
Remove this unnecessary check, vector.contains(), in C++.
2. At Java's CjkBreakEngine, replace "vector.contains()" with "if(pos > previous)" to deal with duplicate breakpoint position.
This way, C++ and Java implementation will be synchronous.
Test: ant checkTest -Dtestclass='com.ibm.icu.dev.test.rbbi.RBBITest'
(RBBTest#TestBreakAllChars() can generate duplicate position for word break. It could pass with this change)
Revise uses of UVector in Formatting related code to better handle memory
allocation failures. This is one of an ongoing series of commits to address
similar problems with UVector usage throughout ICU.
The changes primarily involve switching uses of UVector::addElementX() to the
new adoptElement() or addElement() functions, as appropriate, and using
LocalPointers for tracking memory ownership.
Revise uses of UVector in the next batch of files to better handle memory
allocation failures. This is one of an ongoing series of commits to address
similar problems with UVector usage throughout ICU.
The changes primarily involve switching uses of UVector::addElementX() to the
new adoptElement() or addElement() functions, as appropriate, and using
LocalPointers for tracking memory ownership.
Revise uses of UVector in Locale and Region related code to better handle
memory allocation failures. This is one of an ongoing series of commits to
address similar problems with UVector usage throughout ICU.
The changes involve switching uses of UVector::addElementX() to the new
adoptElement() or addElement() functions, as appropriate, and using
LocalPointers for tracking memory ownership.
In Region::loadRegionData(), improved the overall error detection and recovery.
Change UnicodeString::clone() to return a nullptr if the underlying copy
constructor produces a bogus string. This can happen if the copy constructor
encounters a memory allocation failure in allocating the copy's internal string
buffer, or if the string being copied was already bogus.
The change is consistent with other ICU clone functions, which are generally
defined to return nullptr in case of errors.
Revise uses of UVector in vtzone.cpp to better handle memory allocation
failures. This is one of an ongoing series of commits to address similar
problems with UVector usage throughout ICU.
The changes primarily involve switching uses of UVector::addElementX() to the
new adoptElement() or addElement() functions, as appropriate, and using
LocalPointers for tracking memory ownership.
Revise uses of UVector in time zone related code to better handle memory
allocation failures. This is one of an ongoing series of commits to address
similar problems with UVector usage throughout ICU.
The changes involve switching uses of UVector::addElementX() to the new
adoptElement() or addElement() functions, as appropriate, and using
LocalPointers for tracking memory ownership.