简体   繁体   English

映射到哈希图上,需要返回一个哈希图

[英]map over a hash-map, needs to return a hash-map

What the map function will be accepting will be a 'mapping' function and a hash-map. map函数将接受的是一个“映射”函数和一个hash-map。 The mapping function will be accepting values of type MapEntry. 映射函数将接受MapEntry类型的值。 That is because the collection (hash-map) coming in looks like this: {kvkvkv} , and a MapEntry is this: k v. 这是因为{kvkvkv}的集合(哈希映射)看起来像这样: {kvkvkv} ,而MapEntry是这样的:k v。

I cannot seem to get a {kvkvkv} to be returned. 我似乎无法退回{kvkvkv} I can easily get ([kv] [kv] [kv]) . 我可以轻松得到([kv] [kv] [kv])

I thought of this when just finished typing the question. 刚刚输入问题时,我就想到了这一点。 All you need to do is (into {} ([kv] [kv] [kv])) . 您需要做的只是(into {} ([kv] [kv] [kv])) That will give {kvkvkv} . 那将得到{kvkvkv}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM