Created
March 25, 2014 20:08
-
-
Save stanpalatnik/9ef1b4baefb6847aa58b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tailrec | |
def extractor[T](resultSet: ResultSet, | |
result: scala.collection.mutable.Builder[T, Vector[T]] = Vector.newBuilder[T])( process: ResultSet => T ): Vector[T] = { | |
if (!resultSet.next) result.result() | |
else { | |
val value = process(resultSet) | |
extractor(resultSet, result += value)(process) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment