获取数组中的同一元素,并生成数组 List< User > users = userDao.select(id); List< String > ids = users.stream().map(User::getId).collect(Collectors.toList());