如何将 MultivaluedMap 大写?
我有一个 MultivaluedMap 对象,我想将所有键(而不是值)转换为大写。
我设法迭代该对象,但不知道如何重新加载它。
有什么想法吗?
I have a MultivaluedMap object and I want to convert all the keys (not the values) to uppercase.
I managed to iterate through the object, but I can't figure out how to reload it.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了扩展我对 Ernest 正确答案的评论,以下是我如何实现
remove
-and-put
解决方案:To expand on my comment on Ernest's correct answer, here's how I might implement the
remove
-and-put
solution:在处理每个修改后的键/值对时,您必须将其放入新的映射中。最后,您可以返回新地图,丢弃原始地图,也可以
clear()
原始地图并将临时地图中的所有元素复制回原始地图。没有比这更好的方法了。You'd have to put each modified key/value pair into a new map as you processed it. At the end you could either return the new map, discarding the original, or you could
clear()
the original and copy all the elements from the temporary map back into the original. There's not going to be any better way to do it than that.