C# to Java: where T : new() Syntax
Posted
by Shiftbit
on Stack Overflow
See other posts from Stack Overflow
or by Shiftbit
Published on 2010-04-12T01:35:35Z
Indexed on
2010/04/12
1:43 UTC
Read the original article
Hit count: 397
I am porting some C# code over to Java. I am having trouble with the where Syntax, specifically new(). I understand that where is similar to Java's generic: T extends FOO.
How I can replicate the new() argument in Java?
ie:
public class BAR<T> : BAR
where T : FOO, new()
Right now I have:
public class BAR<T extends FOO> extends ABSTRACTBAR {
public HXIT(T t){
this.value = t;
}
....
}
© Stack Overflow or respective owner