我有一个programTypes列表:
List<String> programTypes = {ACF, VCX, IFL}
Note: This is a map hardcoded in code.
Here, I want to attach priorities to these programTypes:
ACF->priority=2, VCX->priority=1, IFL->priority=3
我应该使用什么数据结构?优先队列?
而且,现在我有一个inputProgramTypes列表:{ABC,VCX,IFL}我希望输出为winningProgramType:VCX
我可以通过在inputProgramTypes上进行迭代并设置winningProgramType来进行编码,如果每个相邻的优先级都大于设置的优先级(例如发现最大问题)。
但是我想知道我是否可以优化?以及如何使用流为其编写代码以使其看起来干净?我是流媒体新手,正在学习如何学习流媒体。
我建议您使用带有参数构造函数的枚举。
可能,一个简单的地图会很好: