Skip to content

Instantly share code, notes, and snippets.

@mpolden
Created October 2, 2012 07:18
Show Gist options
  • Save mpolden/3817006 to your computer and use it in GitHub Desktop.
Save mpolden/3817006 to your computer and use it in GitHub Desktop.
final Collection<Integer> ids =
Collections2.filter(Lists.transform(Arrays.asList(
input.split(",")),
new Function<String, Integer>() {
@Override
public Integer apply(@Nullable final String s) {
return s != null ? Ints.tryParse(s) : null;
}
}), new Predicate<Integer>() {
@Override
public boolean apply(@Nullable final Integer aLong) {
return aLong != null;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment