This is my jsp page.
<body>
<%
String a[] = {"PAK", "ENG", "IND", "USA"};
String b[] = {"ON", "UK","IND","ENG","SA"};
String[] Filterjoined = ObjectArrays.concat(a, b, String.class);
out.println(Arrays.toString(Filterjoined));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < Filterjoined.length; i++) {
boolean found = false;
for (int j = i + 1; j < Filterjoined.length; j++) {
if (Filterjoined[j].equals(Filterjoined[i])) {
found = true;
break;
}
}
if (!found) {
if (sb.length() > 0) {
sb.append(',');
}
sb.append(Filterjoined[i]);
}
}
out.println("<br>");
out.println(sb);
%>
</body>
Here i'm getting output as PAK,USA,ON,UK,IND,ENG,SA but i need to delete string from both arrays if string has duplicated. i.e., expected output is:PAK,USA,ON,UK,ENG,SA because IND has duplicated in both arrays so i need to delete it,remaining elements has to display.Thanks for your reply
response.sendRedirect("http://docs.oracle.com/javase/tutorial/collections/");