Changed MultiByteArrayIterator to operate on a LinearSeq

ByteString.ByteStrings new creates it's iterator on a Stream instead of
a List, making ByteStings.iterator an O(1) operation.
This commit is contained in:
Oliver Schulz 2012-05-26 14:11:53 +02:00
parent 93d5e440ea
commit 7a854a9a83
2 changed files with 9 additions and 6 deletions

View file

@ -211,7 +211,7 @@ object ByteString {
} else throw new IndexOutOfBoundsException(idx.toString)
override def iterator: ByteIterator.MultiByteArrayIterator =
ByteIterator.MultiByteArrayIterator(bytestrings.map(_.iterator)(collection.breakOut))
ByteIterator.MultiByteArrayIterator(bytestrings.toStream map { _.iterator })
def ++(that: ByteString): ByteString = {
if (that.isEmpty) this