@@ -85,7 +85,7 @@ abstract class ZipArchive(override val jpath: JPath) extends AbstractFile with E
8585 }
8686 }
8787
88- private def ensureDir (dirs : java.util .Map [String , DirEntry ], path : String ): DirEntry =
88+ private def ensureDir (dirs : mutable .Map [String , DirEntry ], path : String ): DirEntry =
8989 // OPT inlined from getOrElseUpdate; saves ~50K closures on test run.
9090 // was:
9191 // dirs.getOrElseUpdate(path, {
@@ -95,16 +95,16 @@ abstract class ZipArchive(override val jpath: JPath) extends AbstractFile with E
9595 // dir
9696 // })
9797 dirs get path match {
98- case null =>
98+ case Some (v) => v
99+ case None =>
99100 val parent = ensureDir(dirs, dirName(path))
100101 val dir = new DirEntry (path, parent)
101102 parent.entries(baseName(path)) = dir
102- dirs.put (path, dir)
103+ dirs(path) = dir
103104 dir
104- case v => v
105105 }
106106
107- protected def getDir (dirs : java.util .Map [String , DirEntry ], entry : ZipEntry ): DirEntry = {
107+ protected def getDir (dirs : mutable .Map [String , DirEntry ], entry : ZipEntry ): DirEntry = {
108108 if (entry.isDirectory) ensureDir(dirs, entry.getName)
109109 else ensureDir(dirs, dirName(entry.getName))
110110 }
@@ -149,9 +149,9 @@ final class FileZipArchive(jpath: JPath) extends ZipArchive(jpath) {
149149 override def sizeOption : Option [Int ] = Some (zipEntry.getSize.toInt)
150150 }
151151
152- @ volatile lazy val (root, allDirs): (DirEntry , java.util .Map [String , DirEntry ]) = {
152+ @ volatile lazy val (root, allDirs): (DirEntry , collection .Map [String , DirEntry ]) = {
153153 val root = new DirEntry (" /" , null )
154- val dirs = new java.util. HashMap [String , DirEntry ]; dirs.put (" /" , root)
154+ val dirs = mutable. HashMap [String , DirEntry ](" /" -> root)
155155 val zipFile = openZipFile()
156156 val entries = zipFile.entries()
157157
@@ -199,7 +199,7 @@ final class FileZipArchive(jpath: JPath) extends ZipArchive(jpath) {
199199final class ManifestResources (val url : URL ) extends ZipArchive (null ) {
200200 def iterator (): Iterator [AbstractFile ] = {
201201 val root = new DirEntry (" /" , null )
202- val dirs = new java.util .HashMap [String , DirEntry ]; dirs.put(" /" , root)
202+ val dirs = new mutable .HashMap [String , DirEntry ]; dirs.put(" /" , root)
203203 val manifest = new Manifest (input)
204204 val iter = manifest.getEntries().keySet().iterator().asScala.filter(_.endsWith(" .class" )).map(new ZipEntry (_))
205205
0 commit comments