On Wed, 10 Feb 2010, Mike Schilling wrote:
Tom Anderson wrote:
new SeparatedString("foo=bar", '=')
is equivalent to:
new StringPair("foo", "bar)
*/
class SeparatedString {
public SeparatedString(String str, char separator) {
// now what?
this(split(str, separator));
}
}
private String[] split(String str, char separator)
{
...
}
private SeparatedString(String[] strings)
{
super(strings[0], strings[1]);
}
I refuse to be concerned about the cost of the allocation of the
String array.
Okay. So now:
/** A string pair combining a search term, and the string resulting
from using the term as the parameter to the supplied query.
*/
class TermAndResult extends StringPair {
public KeyAndValueString(String term, PreparedStatement query) {
// and no, it's not Derby or H2
}
}
Believe me, i can keep contriving examples all week!
interesting exceptions.