Commit c827f793 authored by caotao's avatar caotao

功率曲线只查询合成测点

parent 1207da7c
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class Test {
public static class A{
String name1;
String name2;
public String getName1() {
return name1;
}
public void setName1(String name1) {
this.name1 = name1;
}
public String getName2() {
return name2;
}
public void setName2(String name2) {
this.name2 = name2;
}
public A() {
}
public A(String name1, String name2) {
this.name1 = name1;
this.name2 = name2;
}
}
public static void main(String[] args) {
List<A> list = new ArrayList<>();
list.add(new A("1","2"));
list.add(new A("3",null));
list.add(new A(null,"4"));
list.add(new A());
String names = list.stream().map(a ->{
if(a.getName1()!=null&&a.getName2()!=null){
return a.getName1()+","+a.getName2();
}
if(a.getName1()!=null){
return a.getName1();
}
if(a.getName2()!=null){
return a.getName2();
}
return "";
}).collect(Collectors.joining(","));
names.replace("null","");
// System.out.printf(names);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment