校验数组中是否重复字符串

/**
	 * 判断数组中是否有重复的值
	 * @param array
	 * @return
	 */
	public static boolean cheakIsRepeat(String[] array) {
		HashSet<String> hashSet = new HashSet<String>();
		for (int i = 0; i < array.length; i++) {
			hashSet.add(array[i]);
		}
		if (hashSet.size() == array.length) {
			return true;
		} else {
			return false;
		}
	}
发布了125 篇原创文章 · 获赞 27 · 访问量 13万+

猜你喜欢

转载自blog.csdn.net/weixin_39428938/article/details/90607399