Is there a better way to combine two string sets in java?

后端 未结 12 1310
天涯浪人
天涯浪人 2020-12-05 01:41

I need to combine two string sets while filtering out redundant information, this is the solution I came up with, is there a better way that anyone can suggest? Perhaps som

12条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 02:09

    Just use newStringSet.addAll(oldStringSet). No need to check for duplicates as the Set implementation does this already.

提交回复
热议问题