Optional.ofNullable(orderName)
.map(e-> {
try {
return new String(e.getBytes("iso8859-1"),"utf-8");
} catch (UnsupportedEncodingException ex) {
return null;
}
})
.orElse(null),
也就是Optional.ofNullable(strName).map(e -> return new String(e.getBytes("iso8859-1"),"utf-8")).orElse(null);
相关链接