2015-12-12 62 views

回答

2

您可以简单地用一个String-joining Collector像这样

String result = context.entrySet() 
      .stream() 
      .map(e -> e.getKey() + "=" + e.getValue()) 
      .collect(Collectors.joining("")); 

假设你不想要的分隔符。否则,请给Collectors#joining(CharSequence)调用提供适当的分隔符。

+0

甜 - 作品像魅力 - 谢谢! – Ole

相关问题