You could do it with generics:
public <T extends Appendable & Closeable> void spew(T t){
t.append("Bleah!\n");
if (timeToClose())
t.close();
}
Your syntax was almost right, actually.
You could do it with generics:
public <T extends Appendable & Closeable> void spew(T t){
t.append("Bleah!\n");
if (timeToClose())
t.close();
}
Your syntax was almost right, actually.