>As I've been hacking away today, I've been swapping a load of >"" + "" + "" style code over to use StringBuffers. I thought >that perhaps there's a potential use of a static method in >StringUtils to construct these strings from an array
For a significant performance boost we had to refactor the whole (or a major part) of the codebase in this manner. So I think a performance test would be good. How much is the improvement on <delete>? >StringUtils.messageAppender > /** > * Creates log messages using a StringBuffer > * Example: > * <code> > * String[] args = {"1", "2", "3"} > * log(StringUtils.messageAppender(args), Project.MSG_VERBOSE); > * </code> > * @param args the message fragments > * @return the message > * @since ant 1.7 > */ > public static String messageAppender(final Object[] args) { > StringBuffer sb = new StringBuffer(); > for (int i = 0; i < args.length; i++) { > sb.append(args[i]); > } > return sb.toString(); > } This does not create a log message - it just concatenates the given arguments. Would be something like toString(Object[]) better? You specify the args-param as "message fragments", so I would name the paramter 'fragments' ;-) public static String toString(final Object[] fragments) ... mmmh .... alternativly you could overload the Task.log() method... Task.log(Object[] messageFragments, int loglevel) Jan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]