Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc. improvements #58

Open
wants to merge 27 commits into
base: trunk
Choose a base branch
from
Open

Misc. improvements #58

wants to merge 27 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 15, 2017

No description provided.

The use of isEmpty() is generally to be preferred because it is possible
for a size() implementation to be slow, but isEmpty() to be fast.
…cessary

StringBuilder is generally to be preferred over StringBuffer where
synchronization is not necessary.

Other efficiency improvements:
 * Use append(char) when only one character is appended
 * Chain append() calls rather than append a string concatenation
 * Append subsequences directly to avoid creating a new object
 * Re-use StringBuilders rather than create new ones
StrBuilder is like StringBuilder with some extra utility methods that
improve the efficiency of certain code that builds strings.
As addListener(), removeListener(), and getListeners() synchronize
access to listenerMap and idMap, this appears to be necessary.
Previously, if callback was null, an IllegalArgumentException would be
thrown within the try block. This would be caught by the catch (Exception)
block which would dereference callback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant