合并 3 个列表(或更多)
我有 2 个字符串列表/数组
货币列表:
String [] 货币 = {EUR、USD、CAD 等};
时间段列表:
字符串 [] 周期 = {"T","O","SN","1M","1Y","1W","2M","3M","4M","5M ","6M","7M","8M","9M","10M","11M", ...};
后缀列表:
字符串列表后缀 = {"D"、"FSR"、"ND"等};
我想合并它们列表。我需要定义一个映射,因为我不想将所有合并到所有(更像是一些到一些)。
例如:
EUR 可以与句点中的“1M”和“2M”组合,以及与“D”和 后缀中的“FSR”。
美元可以与“1M”、“3M”和“4M”组合 句点,并带有后缀“ND”。
您建议我如何进行此映射?
I have 2 lists/arrays of strings
a list of currencies:
String [] currencies = {EUR, USD, CAD, etc};
a list of time periods:
String [] periods = {"T","O","SN", "1M","1Y","1W", "2M","3M","4M","5M","6M","7M","8M","9M","10M","11M", ...};
a list of suffixes:
String list suffixes = {"D", "FSR", "ND", etc};
I want to merge them lists. I need to define a mapping because I don't want to merge all to all (more like some to some).
For example:
EUR can be combined with "1M" and "2M" from periods, and with "D" and
"FSR" from suffixes.USD can be combined with "1M", "3M" and "4M" from
periods, and with "ND" from suffixes.
How would you suggest I do this mapping?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会使用支持冲突的字典来做到这一点。这就是它们的目的。
I would do it using a dictionary that supports collisions. That is what they are built for.