Is there any way to convert below function into one function in Java ? I tried cascading it using (TestRow ) but that doesn't work.
public void testWindow (TestRow window, String title) {
if (window != null) {
try {
window.zClose(window);
} catch (HarnessException e) {
e.printStackTrace();
}
window = null;
}
}
public void testWindow (TestColumn window, String title) {
if (window != null) {
try {
window.zClose(window);
} catch (HarnessException e) {
e.printStackTrace();
}
window = null;
}
}
Here TestRow and TestColumn is custom types.
Calling would be same way but due to custom window names, i need to copy paste same function many times which i think can be avoidable.
TestColumnandTestRowhave common interface / abstract class to which methodzClosebelongs?