Permalink
Browse files

ReadAheadIterator headOptionReverseCompatibility Altered To Final Val…

…ue Class

Utilizes value class to avoid allocating runtime objects unnecessarily, and is final so that the behavior cannot be overridden in subclasses
  • Loading branch information...
1 parent 03a22d3 commit 54df14c07591879ea1d8ba6e44568cf9599fb42c @ChristopherDavenport ChristopherDavenport committed Sep 1, 2016
Showing with 1 addition and 1 deletion.
  1. +1 −1 slick/src/main/scala/slick/util/ReadAheadIterator.scala
@@ -47,7 +47,7 @@ trait ReadAheadIterator[+T] extends BufferedIterator[T] {
object ReadAheadIterator {
/** Feature implemented in Scala library 2.12 this maintains functionality for 2.11 */
- implicit class headOptionReverseCompatibility[T](readAheadIterator: ReadAheadIterator[T]){
+ final implicit class headOptionReverseCompatibility[T](val readAheadIterator: ReadAheadIterator[T]) extends AnyVal {
def headOption : Option[T] = if (readAheadIterator.hasNext) Some(readAheadIterator.head) else None
}
}

0 comments on commit 54df14c

Please sign in to comment.