Java相关 public static void main(String[] args) { User u1=new User(1, "zhangsan"); User u2=new User(2, "lisan"); User u3=new User(3, "wangsan"); //放入到Set集合中 Set userset=new HashSet(); userset.add(u1); userset.add(u2); userset.add(u3);