Closed sunmingtao closed 4 years ago
List<NameValuePair> arguments = new ArrayList<>(); if (params != null) { for (Map.Entry<String, String> entry : params.entrySet()) { arguments.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } } return arguments;
convert to
return Optional.ofNullable(params) .orElse(Collections.emptyMap()) .entrySet() .stream() .map(e -> new BasicNameValuePair(e.getKey(), e.getValue()) .collect(Collectors.toList());
convert to