上代码
//list对象 转换Set Set<String> collect = users.stream().map(User ->User.getUserName()).collect(Collectors.toSet());
控台测试