假设我有很多这样的对象:
arr = [{time: 1, value: 2, word: 'fdfd'}, {time: 2, value: 3, word: 'dsadsadsa'}]
如何从每个对象中删除时间和单词属性?我的输出应该是这样:
arr = [{value: 2}, {value: 3}]
答案 0 :(得分:0)
您可以尝试使用Array.prototype.map()
和Destructuring assignment
public static <T> void reverse(List<T> list) {
if (list.size() > 0) {
T t;
t = list.get(0);
list.remove(0);
reverse(list);
list.add(t);
}
}