import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class DuplicateValue
{
public static void main(String[] args) {
String [] inputArray = {"a","b","c","d","a"};
Map<String,Integer> hm=new HashMap<>();
for(String name: inputArray) {
Integer count=hm.get(name);
if(count==null){
hm.put(name,1);
}else {
hm.put(name, ++count);
}
}
Set<Entry<String, Integer>> entrySet = hm.entrySet();
for (Entry<String, Integer> entry : entrySet) {
if (entry.getValue() > 1) {
System.out.println("Duplicate element from array : " + entry.getKey());
} }
}
}