Let me say that there is an abstract class that looks like
abstract class Parent<V> {
protected static <T extends Parent<V>, V> T newInstance(
final Class<T> type, final V value) {
// ...
}
}
Inside the next child class
class Child extends Parent<XXX> {
public static Child newInstance1(final XXX value) {
// ...
}
public static Parent<XXX> newInstance2(final XXX value) {
// ...
}
}
Which one is preferable? newInstance1or newInstancw2?
source
share