Map<String,String> mailParams = new LinkedHashMap<>();

mailParams.put("Action","SingleSendMail");
mailParams.put("AccountName", "service@qq.com");
mailParams.put("ReplyToAddress", "true");
mailParams.put("AddressType", "1");
mailParams.put("ToAddress", "zhangpengshou@qq.com");
mailParams.put("Subject", "Subject");
mailParams.put("HtmlBody","body");
mailParams.put("Format", "json");
mailParams.put("Version", "2015-11-23");
mailParams.put("Signature", "");
mailParams.put("SignatureMethod", "HMAC-SHA1");
mailParams.put("SignatureNonce","");
mailParams.put("SignatureVersion", "1.0");
mailParams.put("AccessKeyId","");
mailParams.put("Timestamp", "2017-05-04T19:55:00Z");

mailParams = mailParams.entrySet().stream().sorted(Map.Entry.comparingByKey(Comparator.naturalOrder())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> v1, LinkedHashMap::new));

mailParams.entrySet().forEach(entry -> System.out.println(String.format("%s=%s", entry.getKey(), entry.getValue())));

 

相关文章:

  • 2021-11-26
  • 2021-04-08
  • 2021-10-29
  • 2022-02-15
  • 2021-09-05
  • 2021-10-21
  • 2022-01-07
  • 2021-06-27
猜你喜欢
  • 2022-12-23
  • 2021-10-09
  • 2021-12-02
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2022-02-21
相关资源
相似解决方案