java how to check for duplicates code example
Example: java find duplicates in array
// Uses a set, which does not allow duplicates
for (String name : names)
{
if (set.add(name) == false)
{
// print name your duplicate element
}
}