合并 3 个列表(或更多)

发布于 2024-12-21 05:28:00 字数 545 浏览 2 评论 0原文

我有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少女的英雄梦 2024-12-28 05:28:00

我会使用支持冲突的字典来做到这一点。这就是它们的目的。

I would do it using a dictionary that supports collisions. That is what they are built for.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文