Need a Java function to find intersection of two strings. i.e. characters common to the strings.
Example:
String s1 = new String(\"Sychelless\"); St
By means of Guava this task seems much easier:
String s1 = new String("Sychelless"); String s2 = new String("Sydney"); Set setA = Sets.newHashSet(Splitter.fixedLength(1).split(s1)); Set setB = Sets.newHashSet(Splitter.fixedLength(1).split(s2)); Sets.intersection(setA, setB);