diff options
author | Michael Koch <konqueror@gmx.de> | 2004-11-16 07:44:40 +0000 |
---|---|---|
committer | Michael Koch <konqueror@gmx.de> | 2004-11-16 07:44:40 +0000 |
commit | 3bb4c7112fe395f07e1f37fcdef07573678f033a (patch) | |
tree | 09c02b90504274fc3c48c10059302b4ccae3ad5c | |
parent | d7719747d45b14d9b1369df7ea25df1f196e6ae5 (diff) | |
download | classpath-3bb4c7112fe395f07e1f37fcdef07573678f033a.tar.gz |
2004-11-16 Michael Koch <konqueror@gmx.de>
* gnu/java/awt/peer/gtk/GdkFontPeer.java
(buildString): Optimise String building.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | gnu/java/awt/peer/gtk/GdkFontPeer.java | 28 |
2 files changed, 19 insertions, 14 deletions
@@ -1,3 +1,8 @@ +2004-11-16 Michael Koch <konqueror@gmx.de> + + * gnu/java/awt/peer/gtk/GdkFontPeer.java + (buildString): Optimise String building. + 2004-11-15 Michael Koch <konqueror@gmx.de> * native/jni/Makefile.am: Add checking of JNI methods. diff --git a/gnu/java/awt/peer/gtk/GdkFontPeer.java b/gnu/java/awt/peer/gtk/GdkFontPeer.java index 5b873e582..ee0514510 100644 --- a/gnu/java/awt/peer/gtk/GdkFontPeer.java +++ b/gnu/java/awt/peer/gtk/GdkFontPeer.java @@ -95,31 +95,31 @@ public class GdkFontPeer extends ClasspathFontPeer * triplicate. */ - private String buildString(CharacterIterator i) { - String s = new String (); - for(char c = i.first(); c != CharacterIterator.DONE; c = i.next()) - s += c; - return s; + private String buildString(CharacterIterator iter) + { + StringBuffer sb = new StringBuffer(); + for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) + sb.append(c); + return sb.toString(); } - private String buildString(CharacterIterator iter, int begin, int limit) { - String s = new String (); + private String buildString(CharacterIterator iter, int begin, int limit) + { + StringBuffer sb = new StringBuffer(); int i = 0; for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next(), i++) { if (begin <= i) - s += c; + sb.append(c); if (limit <= i) break; } - return s; + return sb.toString(); } - private String buildString(char[] chars, int begin, int limit) { - String s = new String (); - for(int i = begin; i <= limit; i++) - s += chars[i]; - return s; + private String buildString(char[] chars, int begin, int limit) + { + return new String(chars, begin, limit - begin); } /* Public API */ |