I have the following implicit conversion for java.util.Enumerations
implicit def enumerationIterator[A](e : Enumeration[A]) : Iterator[A] = {
new Iterator[A] {
def hasNext = e.hasMoreElements
def next = e.nextElement
def remove = throw new UnsupportedOperationException()
}
}
Unfortunately it does not work for ZipFile.entries
because it returns an Enumeration<? extends ZipEntry>
(see related question) and Scalac keeps telling me
type mismatch; found : java.util.Iterator[?0]
where type ?0 <: java.util.zip.ZipEntry
required: Iterator[?]
I can't figure out how to make the conversation work in sth. like
List.fromIterator(new ZipFile(z).entries))