I'd prefer this which is simpler than all of the above.
public void removeDuplicates() {
String myString = "Bangalore-Chennai-NewYork-Bangalore-Chennai";
String[] array = myString.split("-");
Set hashSet = new HashSet(Arrays.asList(array));
String newString = StringUtils.join(hashSet, "-");
}