function BasicDatePicker(){
const [selectedDate, handleDateChange] = useState(new Date());
return (
<MuiPickersUtilsProvider utils={DateFnsUtils}>
<DatePicker
label="Basic example"
value={selectedDate}
onChange={handleDateChange}
animateYearScrolling
/>
</MuiPickersUtilsProvider>
);
}
class GameList extends Component {
state = {};
render() {
const { classes } = this.props;
return (
<div id="gameList">
<BasicDatePicker />
</div>
);
}
}
export default (GameList);
arrayList已恢复
ArrayList<String> single = new ArrayList<String>();
---------
System.out.println(single)
期望的结果
[Document{{googContentType=realtime, packetsLost=0, id=ssrc_3841594688_recv, type=ssrc, timestamp=2019-07-11T07:18:43.413Z}}
,Document{{googContentType=realtime, packetsLost=0, id=ssrc_239620516_recv, type=ssrc, timestamp=2019-07-11T07:18:42.955Z}}]
答案 0 :(得分:0)
不一定是最佳实践,但是您可以进行正则表达式替换来删除最终输出中不需要的键值对:
List<String> singleOut = single.stream()
.map(x -> x.replaceAll("(?:googContentType|id|type)=\\S+\\s*", ""))
.collect(Collectors.toList());
singleOut.forEach(System.out::println);
此打印:
Document{{packetsLost=0, timestamp=2019-07-11T07:18:43.413Z}}
Document{{packetsLost=0, timestamp=2019-07-11T07:18:42.955Z}}
这里最好的解决方案是返回生成此JSON风格对象的工具/代码,然后重新导出,只包含要显示的packetsLost
和timestamp
键。