假设我有2个接口,A和B:
public interface A {
List<B> getBs();
}
public interface B {
}
Run Code Online (Sandbox Code Playgroud)
和2个实现这些接口的类:
public class AImpl implements A {
public List<B> getBs() {
return null;
}
}
public class BImpl implements B {
}
Run Code Online (Sandbox Code Playgroud)
是否可能(可能使用泛型)我的getter方法返回BImpl类型对象的列表,如下所示:
public class AImpl implements A {
public List<BImpl> getBs() {
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢
我有一个字符串(包含JSON):
[{"type":[236]} , {"type":[2]} , {"type":[95]}, {"other":[33]}, {"other":[44]}]
Run Code Online (Sandbox Code Playgroud)
我想使用正则表达式只提取TYPE数字,以便输出是以下字符串:
[236 , 2 , 95]
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?