Check-in [74c9fa8b65]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In String.replace() if the input string does not contain the character to be replaced then it returns `this`.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:74c9fa8b659805db1dcae7deec279a9510f5a9a4
User & Date: stephanie.gawroriski 2019-05-24 13:38:50
Context
2019-05-24
14:09
Change String to use character arrays instead of sequences (faster). check-in: 8b68b756c8 user: stephanie.gawroriski tags: trunk
13:38
In String.replace() if the input string does not contain the character to be replaced then it returns `this`. check-in: 74c9fa8b65 user: stephanie.gawroriski tags: trunk
13:37
Add quick flag for an intern check so that `this` is quickly returned if the string is already an intern. check-in: 25bf7f0071 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/apis/cldc-compact/java/lang/String.java.

915
916
917
918
919
920
921
922

923
924
925
926
927
928
929
930
	 * @param __a The starting character.
	 * @param __b The replacement character.
	 * @since 2018/09/22
	 */
	public String replace(char __a, char __b)
	{
		// If a character is going to be replaced with itself then no
		// replacement has to actually be performed.

		if (__a == __b)
			return this;
		
		// Get source sequence
		BasicSequence bs = this._sequence;
		int n = bs.length();
		
		// Copy data into an array with translated characters







|
>
|







915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
	 * @param __a The starting character.
	 * @param __b The replacement character.
	 * @since 2018/09/22
	 */
	public String replace(char __a, char __b)
	{
		// If a character is going to be replaced with itself then no
		// replacement has to actually be performed. Or if the original
		// character is not even in the string.
		if (__a == __b || this.indexOf(__a) < 0)
			return this;
		
		// Get source sequence
		BasicSequence bs = this._sequence;
		int n = bs.length();
		
		// Copy data into an array with translated characters