Here you can find the source of isDuplicated(String[] strArray)
Parameter | Description |
---|---|
strArray | a parameter |
public static boolean isDuplicated(String[] strArray)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /**//w ww . j a v a2 s. c o m * Check if there are duplicated values in a string array * * @param strArray * @return */ public static boolean isDuplicated(String[] strArray) { Set<String> strSet = new HashSet<String>(); for (int i = 0; i < strArray.length; i++) { strSet.add(strArray[i]); } return (strSet.size() < strArray.length) ? true : false; } }