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

后端 未结 12 1265
天涯浪人
天涯浪人 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:06

    If you are using the Apache Common, use SetUtils class from org.apache.commons.collections4.SetUtils;

    SetUtils.union(setA, setB);
    

提交回复
热议问题