本文实例讲述了java字符串求并集的方法。分享给大家供大家参考。
具体实现代码如下:
复制代码代码如下:
String[] arr1 = {"abcd", "dfg", "abc"};
String[] arr2 = {"abcd", "ccd", "df", "d", "abc"};
String[] result_union = union(arr1, arr2);
System.out.println("求并集的结果如下:");
for (String str : result_union) {
System.out.println(str);
}
String[] arr2 = {"abcd", "ccd", "df", "d", "abc"};
String[] result_union = union(arr1, arr2);
System.out.println("求并集的结果如下:");
for (String str : result_union) {
System.out.println(str);
}
希望本文所述对大家的Java程序设计有所帮助。