Removed final specifier on some ByteString and ByteIterator methods

This commit is contained in:
Oliver Schulz 2012-06-17 22:22:40 +02:00
parent b6b117cf54
commit 20e313e6a5
2 changed files with 8 additions and 8 deletions

View file

@ -409,7 +409,7 @@ abstract class ByteIterator extends BufferedIterator[Byte] {
// the parent class. // the parent class.
override def drop(n: Int): this.type = throw new UnsupportedOperationException("Method drop is not implemented in ByteIterator") override def drop(n: Int): this.type = throw new UnsupportedOperationException("Method drop is not implemented in ByteIterator")
final override def slice(from: Int, until: Int): this.type = { override def slice(from: Int, until: Int): this.type = {
if (from > 0) drop(from).take(until - from) if (from > 0) drop(from).take(until - from)
else take(until) else take(until)
} }
@ -431,16 +431,16 @@ abstract class ByteIterator extends BufferedIterator[Byte] {
(this, that) (this, that)
} }
final override def indexWhere(p: Byte Boolean): Int = { override def indexWhere(p: Byte Boolean): Int = {
var index = 0 var index = 0
var found = false var found = false
while (!found && hasNext) if (p(next())) { found = true } else { index += 1 } while (!found && hasNext) if (p(next())) { found = true } else { index += 1 }
if (found) index else -1 if (found) index else -1
} }
final def indexOf(elem: Byte): Int = indexWhere { _ == elem } def indexOf(elem: Byte): Int = indexWhere { _ == elem }
final override def indexOf[B >: Byte](elem: B): Int = indexWhere { _ == elem } override def indexOf[B >: Byte](elem: B): Int = indexWhere { _ == elem }
def toByteString: ByteString def toByteString: ByteString
@ -449,13 +449,13 @@ abstract class ByteIterator extends BufferedIterator[Byte] {
override def foreach[@specialized U](f: Byte U): Unit = override def foreach[@specialized U](f: Byte U): Unit =
while (hasNext) f(next()) while (hasNext) f(next())
final override def foldLeft[@specialized B](z: B)(op: (B, Byte) B): B = { override def foldLeft[@specialized B](z: B)(op: (B, Byte) B): B = {
var acc = z var acc = z
foreach { byte acc = op(acc, byte) } foreach { byte acc = op(acc, byte) }
acc acc
} }
final override def toArray[B >: Byte](implicit arg0: ClassManifest[B]): Array[B] = { override def toArray[B >: Byte](implicit arg0: ClassManifest[B]): Array[B] = {
val target = Array.ofDim[B](len) val target = Array.ofDim[B](len)
copyToArray(target) copyToArray(target)
target target

View file

@ -285,7 +285,7 @@ sealed abstract class ByteString extends IndexedSeq[Byte] with IndexedSeqOptimiz
override def copyToArray[B >: Byte](xs: Array[B], start: Int, len: Int): Unit = override def copyToArray[B >: Byte](xs: Array[B], start: Int, len: Int): Unit =
iterator.copyToArray(xs, start, len) iterator.copyToArray(xs, start, len)
@inline final override def foreach[@specialized U](f: Byte U): Unit = iterator foreach f override def foreach[@specialized U](f: Byte U): Unit = iterator foreach f
/** /**
* Efficiently concatenate another ByteString. * Efficiently concatenate another ByteString.
@ -327,7 +327,7 @@ sealed abstract class ByteString extends IndexedSeq[Byte] with IndexedSeqOptimiz
* Creates a new ByteBuffer with a copy of all bytes contained in this * Creates a new ByteBuffer with a copy of all bytes contained in this
* ByteString. * ByteString.
*/ */
final def toByteBuffer: ByteBuffer = ByteBuffer.wrap(toArray) def toByteBuffer: ByteBuffer = ByteBuffer.wrap(toArray)
/** /**
* Decodes this ByteString as a UTF-8 encoded String. * Decodes this ByteString as a UTF-8 encoded String.