comparing two collections for comparing two text files for additions, deletions, modifications

前端 未结 4 1018
鱼传尺愫
鱼传尺愫 2020-12-21 21:36

I have two collections as below which hold IDs for Students.

The ids are Strings in the format 111-1111. e.g. of ids 221-2534, 215-6365, etc.

 Collec         


        
4条回答
  •  情歌与酒
    2020-12-21 21:49

    If your files are not too large, maybe you can do the following steps

    • Create a HashMap
    • For every entry in old file, add it with value 'Old'
    • For every entry in new file,
      • Check if it is in the HashMap
        • If so, then set value 'Both' (Additionally, you could add it to a HashMap of common elements)
        • If not, add it with value 'New'

    This should hopefully address question 2. Please do let me know if it works. Thanks!

提交回复
热议问题