JDK8新写法

去重:

list.stream.distinct().collect(Collectors.toList());

list转map,value值是属于的参数,输入的是什么就是什么

Map<Integer,PolicyBasePo> map = list.stream().collect(Collectors.toMap(PolicyBasePo::getId,Function.identity()));

map里去重,如果map中o1和o2的key相同,则保留o1

list.stream().filter(tblPolicy->deviceIdList.contains(Long.valueOf(tblPolicy.getDeviceId()))).collect(Collcetors.toMap(TblPolicy::getId,Function.identity(),(o1,o2)->o1));

java 调用Linux环境运行Linuxshell脚本

String[] info = exect(String script,String cmdDir) info[0]为ip地址?

script = "./scripts/get_cluster.sh"

cmdDir = /usr/opt/xg

Process process = null;

try{

List<String> result = new ArrayList<>();

process = Runtime.getRuntime().exec(script,new String[]{},new File(cmdDir));

BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStreadm()));

String line = null;

while((line = input.readline())!= null){

        result.add(line);

}

input.close();

if(result.size()>0){

        return result.toArray(new String[result.size()]);

}

int exitval = process.waitFor();

log.info("",new Object[]{exitVal});

return new String[]{};  废代码

}catch(Exception e){

}

返回两个值:

ImmutablePair<String,String> 

return ImmutablePair.of(privateKey,publicKey);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值