利用Java8 StreamAPI完成项目需求
需求
将一批数据转换成页面的格式,如下 表格1
IP | 类型 | 次数 |
---|---|---|
172.12.12.1 | 2 | |
172.12.12.2 | 微信 | 1 |
172.12.12.2 | 2 |
public class Demo2 {
public static class ImageItem{
private String id ;
private String type ;
private String ip ;
private String account ;
public ImageItem(String id, String type, String ip, String account) {
this.id = id;
this.type = type;
this.ip = ip;
this.account = account;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getType() {
return type;
}
public v