Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Mar 5th, 2012  |  syntax: Scala  |  size: 0.57 KB  |  hits: 62  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.nio.file.DirectoryStream // this is Iterable[Path]
  2. import scala.collection.JavaConversions._
  3.  
  4.                 // there's a file entry in directory on which following loops should return
  5.  
  6.                 // this works
  7.                 val dirs = Files.newDirectoryStream(appDir)
  8.                 val it = dirs.iterator
  9.                 while (it.hasNext) { // do something and return
  10.                 }
  11.                 throw new ArchiveNotFoundException(this, name, suffix)
  12.  
  13.                 // this doesn't work
  14.                 val dirs = Files.newDirectoryStream(appDir)
  15.                 for (path <- dirs) { // do something and return
  16.                 }
  17.                 throw new ArchiveNotFoundException(this, name, suffix)