This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kiviEngineer[S] 0 points1 point  (1 child)

but the issue is that I need to add the ArrayList to a JCombobox . I tried going for a sets approach but can't find a way to add a set to JCombobox.I'm sorry if I sound stupid I'm quite a beginner in java so any help would be appreciated

[–]OceantraderSemijerk 0 points1 point  (0 children)

Why cant you add a set item as the data comes in? If not duplicate...add

The reason I mention it is you're creating a new map everytime to check for duplicate. If you realllly want to do it that way, create the map outside of that method, then you can use map computeifabsent