can someone please help me to solve this? Thank you
String a = 1||2||3
String b = 2||4||5
String c = 1||2||3||4||5|| //Must be uniqe
can someone please help me to solve this? Thank you
String a = 1||2||3
String b = 2||4||5
String c = 1||2||3||4||5|| //Must be uniqe
Using converting to arrays or lists? I do not know what your mean. but I suggest
String a = "1||2||3";
String b = "2||4||5";
String[] arrayA = a.split("||");
String[] arrayB = b.split("||");
List<String> list = Arrays.asList(arrayA);
list.addAll(Arrays.asList(arrayB));
System.console().printf(list.stream().distinct().collect(Collectors.joining("||")));