title: How to convert a Java Stream to a Scala Stream?
body: <p>As a part of an effort of converting Java code to Scala code, I need to convert the Java stream <code>Files.walk(Paths.get(ROOT))</code> to Scala. I can't find a solution by googling. <code>asScala</code> won't do it. Any hints?</p>
  <p>Here is the related code:</p>
  <pre><code>import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
  import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
  
  import java.io.IOException;
  import java.nio.file.Files;
  import java.nio.file.Paths;
  import java.util.stream.Collectors;
  
  // ...snip...
  
  Files.walk(Paths.get(ROOT))
       .filter(path -&gt; !path.equals(Paths.get(ROOT)))
       .map(path -&gt; Paths.get(ROOT).relativize(path))
       .map(path -&gt; linkTo(methodOn(FileUploadController.class).getFile(path.toString())).withRel(path.toString()))
       .collect(Collectors.toList()))
  </code></pre>
  <p>The <code>Files.walk(Paths.get(ROOT))</code> return type is <code>Stream&lt;Path&gt;</code> in Java.</p>