/** * 合并两个字符串去除重复的值(字符串必须以,分割) * * @param aStr * @param bStr * @return */ private String mergeString(String aStr, String bStr) { if (aStr == null || bStr == null) { return null; } String[] aArr = aStr.split(","); String[] bArr = bStr.split(","); Set<String> set = Sets.newHashSet(); set.addAll(Arrays.asList(aArr)); set.addAll(Arrays.asList(bArr)); return Arrays.toString(set.toArray()); } /** * 从targetStr中删除cutStr中的值(字符串必须以,分割) * * @param targetStr * @param cutStr * @return */ private String cutString(String targetStr, String cutStr) { if (targetStr == null || cutStr == null) { return null; } String[] tarArr = targetStr.split(","); String[] cutArr = cutStr.split(","); Set<String> set = Sets.newHashSet(); set.addAll(Arrays.asList(tarArr)); set.removeAll(Arrays.asList(cutArr)); return Arrays.toString(set.toArray()); }