He-Pin commented on code in PR #1247: URL: https://github.com/apache/pekko/pull/1247#discussion_r1550967633
########## actor/src/main/scala-2.12/org/apache/pekko/util/ByteString.scala: ########## @@ -790,6 +843,30 @@ sealed abstract class ByteString extends IndexedSeq[Byte] with IndexedSeqOptimiz // optimized in subclasses override def indexOf[B >: Byte](elem: B): Int = indexOf(elem, 0) + // optimized version of indexOf for bytes, optimized in subclasses + /** + * Finds index of first occurrence of some byte in this ByteString after or at some start index. + * + * Similar to indexOf, but it avoids boxing if the value is already a byte. + * + * @param elem the element value to search for. + * @param from the start index + * @return the index `>= from` of the first element of this ByteString that is equal (as determined by `==`) + * to `elem`, or `-1`, if none exists. + */ + def indexOf(elem: Byte, from: Int): Int = indexOf(elem, from) Review Comment: add `@since 1.1.0` ########## actor/src/main/scala-2.12/org/apache/pekko/util/ByteString.scala: ########## @@ -790,6 +843,30 @@ sealed abstract class ByteString extends IndexedSeq[Byte] with IndexedSeqOptimiz // optimized in subclasses override def indexOf[B >: Byte](elem: B): Int = indexOf(elem, 0) + // optimized version of indexOf for bytes, optimized in subclasses + /** + * Finds index of first occurrence of some byte in this ByteString after or at some start index. + * + * Similar to indexOf, but it avoids boxing if the value is already a byte. + * + * @param elem the element value to search for. + * @param from the start index + * @return the index `>= from` of the first element of this ByteString that is equal (as determined by `==`) + * to `elem`, or `-1`, if none exists. + */ + def indexOf(elem: Byte, from: Int): Int = indexOf(elem, from) + + /** + * Finds index of first occurrence of some byte in this ByteString. + * + * Similar to indexOf, but it avoids boxing if the value is already a byte. + * + * @param elem the element value to search for. + * @return the index `>= from` of the first element of this ByteString that is equal (as determined by `==`) + * to `elem`, or `-1`, if none exists. + */ + def indexOf(elem: Byte): Int = indexOf(elem, 0) Review Comment: add `@since 1.1.0` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
