Skip to content

Instantly share code, notes, and snippets.

@rafarocha
Created November 21, 2014 20:12
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 rafarocha/553ae7109479bfb2274d to your computer and use it in GitHub Desktop.
Save rafarocha/553ae7109479bfb2274d to your computer and use it in GitHub Desktop.
Removendo string nula ou vazia com FluentIterable
private static Iterable<String> filter(Iterable<String> strings) {
if ( Iterables.isEmpty(strings) ) return null;
return FluentIterable
.from( strings )
.filter( new Predicate<String>() {
@Override public boolean apply(String value) {
return !isEmpty( strip(value) );
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment