1.将集合或数组转换成set val uniq = t.toSet 2. 判断 if(t.size != uniq.size){ print("元素不唯一") }else{ print("元素唯一") }