Skip to content

Instantly share code, notes, and snippets.

@codethereforam
Created July 26, 2018 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codethereforam/07df10a14d1207029561b5d06ca86a17 to your computer and use it in GitHub Desktop.
Save codethereforam/07df10a14d1207029561b5d06ca86a17 to your computer and use it in GitHub Desktop.
集合转换为其成员变量的集合(before java8)
List<String> nameList = Lists.transform(departmentDtoList, new Function<DepartmentDto, String>() {
@Nullable
@Override
public String apply(@Nullable DepartmentDto input) {
return input != null ? input.getDepartmentName() : null;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment