title: Guava: how to combine filter and transform?
body: <p>I have a collection of Strings, and I would like to convert it to a collection of strings were all empty or null Strings are removed and all others are trimmed.</p>
  
  <p>I can do it in two steps:</p>
  
  <pre><code>final List&lt;String&gt; tokens =
      Lists.newArrayList(" some ", null, "stuff\t", "", " \nhere");
  final Collection&lt;String&gt; filtered =
      Collections2.filter(
          Collections2.transform(tokens, new Function&lt;String, String&gt;(){
  
              // This is a substitute for StringUtils.stripToEmpty()
              // why doesn't Guava have stuff like that?
              @Override
              public String apply(final String input){
                  return input == null ? "" : input.trim();
              }
          }), new Predicate&lt;String&gt;(){
  
              @Override
              public boolean apply(final String input){
                  return !Strings.isNullOrEmpty(input);
              }
  
          });
  System.out.println(filtered);
  // Output, as desired: [some, stuff, here]
  </code></pre>
  
  <p>But is there a Guava way of combining the two actions into one step?</p>