📅  最后修改于: 2022-03-11 14:52:38.244000             🧑  作者: Mango
// Uses a set, which does not allow duplicates
for (String name : names)
{
if (set.add(name) == false)
{
// print name your duplicate element
}
}