java find deplicate 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
}
}
// Uses a set, which does not allow duplicates
for (String name : names)
{
if (set.add(name) == false)
{
// print name your duplicate element
}
}