词云

0

今天研究了一个词云的JS插件:d3-cloud

github:https://github.com/jasondavies/d3-cloud

演示地址:https://www.jasondavies.com/wordcloud/

DEMO地址:https://www.acgist.com/demo/d3-cloud/index.html

其实最主要的是研究了Java的lambdastream

// list里面的字符串格式:a|b|c
Map<String, Long> tagstrMap = list.stream()
	.filter(value -> value != null && !value.isEmpty())
	.map(value -> value.split("\\|"))
	.flatMap(value -> Arrays.stream(value))
	.map(String::toUpperCase)
	.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));