我有这种方法,它需要许多列表,其中包含几行书。我将它们组合到一个流中,然后遍历它们以拆分所有非字母的\\P{L}。
有没有办法避免for-each循环并在流中处理它?
private List<String> getWordList(List<String>... lists) {
List<String> wordList = new ArrayList<>();
Stream<String> combinedStream = Stream.of(lists)
.flatMap(Collection::stream);
List<String> combinedLists = combinedStream.collect(Collectors.toList());
for (String line: combinedLists) {
wordList.addAll(Arrays.asList(line.split("\\P{L}")));
}
return wordList;
}
Run Code Online (Sandbox Code Playgroud) 我想打印这个 HTML 表格,其中的元素显示为圆形边框,但是一旦我打印页面,CSS 类似乎就不再显示了。有人可以帮忙吗?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
.hashtag {
display: inline-block;
color: white;
font-size: 20px;
background-color: rgba(46, 200, 40, 0.5);
margin-left: 1px;
margin-right: 1px;
margin-top: 1px;
margin-bottom: 1px;
padding: 0.0em 0.5em;
border-radius: 1em;
text-indent: 0;
text-align: center;
}
</style>
</head>
<body>
<tr>
<td>
<p class="hashtag" align="center">CSS</p>
<p class="hashtag" align="center">WON'T</p>
<p class="hashtag" align="center">PRINT</p>
</td>
</tr>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)