title: Java 8 Streams for String manipulation
body: <p>I want to perform multiple tasks on a single string. 
  I need to get a string and extract different sub-strings using a delimiter (<code>"/"</code>), then reverse the list of sub-strings and finally join them using another delimiter (<code>"."</code>) such that <code>/tmp/test/hello/world/</code> would turn into: <code>world.hello.test.tmp</code></p>
  
  <p>Using Java 7 the code is as follows:</p>
  
  <pre><code>String str ="/tmp/test/";
  List&lt;String&gt; elephantList = new ArrayList&lt;String&gt;(Arrays.asList(str.split("/")));
  
  StringBuilder sb = new StringBuilder();
  for (int i=elephantList.size()-1; i&gt;-1; i--) {
      String a = elephantList.get(i);
      if (a.equals(""))
      {
          elephantList.remove(i);
      }
      else
      {
          sb.append(a);
          sb.append('.');
      }
  }
  sb.setLength(sb.length() - 1);
  System.out.println("result" + elephantList + "   " + sb.toString());
  </code></pre>
  
  <p>I was wondering how I could do the same thing using Java 8 streams and the join function it has for Strings</p>