@@ -85,7 +85,7 @@ abstract class ZipArchive(override val jpath: JPath) extends AbstractFile with E
85
85
}
86
86
}
87
87
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 =
89
89
// OPT inlined from getOrElseUpdate; saves ~50K closures on test run.
90
90
// was:
91
91
// dirs.getOrElseUpdate(path, {
@@ -95,16 +95,16 @@ abstract class ZipArchive(override val jpath: JPath) extends AbstractFile with E
95
95
// dir
96
96
// })
97
97
dirs get path match {
98
- case null =>
98
+ case Some (v) => v
99
+ case None =>
99
100
val parent = ensureDir(dirs, dirName(path))
100
101
val dir = new DirEntry (path, parent)
101
102
parent.entries(baseName(path)) = dir
102
- dirs.put (path, dir)
103
+ dirs(path) = dir
103
104
dir
104
- case v => v
105
105
}
106
106
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 = {
108
108
if (entry.isDirectory) ensureDir(dirs, entry.getName)
109
109
else ensureDir(dirs, dirName(entry.getName))
110
110
}
@@ -149,9 +149,9 @@ final class FileZipArchive(jpath: JPath) extends ZipArchive(jpath) {
149
149
override def sizeOption : Option [Int ] = Some (zipEntry.getSize.toInt)
150
150
}
151
151
152
- @ volatile lazy val (root, allDirs): (DirEntry , java.util .Map [String , DirEntry ]) = {
152
+ @ volatile lazy val (root, allDirs): (DirEntry , collection .Map [String , DirEntry ]) = {
153
153
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)
155
155
val zipFile = openZipFile()
156
156
val entries = zipFile.entries()
157
157
@@ -199,7 +199,7 @@ final class FileZipArchive(jpath: JPath) extends ZipArchive(jpath) {
199
199
final class ManifestResources (val url : URL ) extends ZipArchive (null ) {
200
200
def iterator (): Iterator [AbstractFile ] = {
201
201
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)
203
203
val manifest = new Manifest (input)
204
204
val iter = manifest.getEntries().keySet().iterator().asScala.filter(_.endsWith(" .class" )).map(new ZipEntry (_))
205
205
0 commit comments