Please Suggest best way to pass Strings in a pipeline
I'm working in a project in which a line passes in a pipeline kind of situation.
The String is passed between different modules and each module adds some more data to it (or may even remove some of it).
Which is the best way to pass the String? I think java.lang.String might not be an efficient method because the String i'll be passing will be modified many times.
Thanx
[399 byte] By [
LordZeusa] at [2007-11-27 6:55:49]

Yes. StringBuffer or StringBuilder you can use.
String string = "test";
StringBuffer sb = new StringBuffer(string);
later you will add some more strings to the StringBuffer
sb.append("Hello World");
No additiional String object will be created.
just another option, you can use String array with length = 1.
public void method(String[] str) {
// to use
str[0] = "pointer's brother";
}
> just another option, you can use String array with
> length = 1.
> > public void method(String[] str) {
>// to use
> str[0] = "pointer's brother";
> }
>
That would be quite useless.