Shi Peng 2015-09-10 15:19 采纳率: 0%
浏览 2495

求:Java实现下面的算法,要求尽量高的性能

算法要求:把下面两个list:

columnNames list: ["Comment", "Comment", "Cost", "Term", "Cost"]

columnValues list: ["my comment 1", "my comment 2", "my cost 1", "my term", "my cost 2"]

变成:

columnNames list: ["Comment", "Cost", "Term"]

columnValues list: [["my comment 1", "my comment 2"], ["my cost 1", "my cost 2"], "my test"]

其中columnNames list中的元素Comment和Comment是重复的,要求新的List里面不能重复。

谢谢!

  • 写回答

13条回答 默认 最新

  • threenewbee 2015-09-10 15:27
    关注

    用hashtable,Names直接把字符串作为key,值无所谓。
    Values,将字符串去掉数字作为Key,value是ArrayList,并且把自身添加进去。

    评论

报告相同问题?