0
我想重构下面的方法使用泛型或不同的东西我不能拿出来。杰克逊的泛型为阵列反序列化
public Double[] reverseDoubles() throws IOException {
String sarray = get.array();
Double[] array = mapper.readValue(sarray, Double[].class);
return ArrayUtils.reverse(array);
}
public Long[] reverseLongs() throws IOException {
String sarray = get.array();
Long[] array = mapper.readValue(sarray, Long[].class);
return ArrayUtils.reverse(array);
}
我期待重构的所有方法为唯一一家具有以下特征:
public <T> T[] reverse() throws IOException {
...
}
这是不可能的定签名。研究*类型擦除*。 – shmosel