stream.of可以创建一个stream
Stream<String> stringStream = Stream.of(appId, currentTimeMillis, mobile, secret);
stream通过collect可以生成list
List<String> strings = stringStream.collect(Collectors.toList());
项目实战案例
List<String> stringList = Stream.of(appId, currentTimeMillis, mobile, secret).collect(Collectors.toList());
String append = Joiner.on("").join(stringList);
String sign = SecretUtil.encrypt32Lower(append);
String encryptMobile = AESUtil.encrypt(mobile, password);
Map<String,Object> paramsMap = new HashMap<String,Object>() {{
put("mobile",encryptMobile);
put("appId",appId);
put("sign",sign);
put("timestamp",currentTimeMillis);
}};
利用Joiner将list转成string