Permalink
Browse files

Use 'for' loops instead of 'while' ones on 'JdbcTypesComponent.scala'

  • Loading branch information...
1 parent 339791d commit 86a2e76ea8ba5274d7294583c3a053df238d7412 @xavier-fernandez xavier-fernandez committed Dec 25, 2015
Showing with 5 additions and 10 deletions.
  1. +5 −10 slick/src/main/scala/slick/jdbc/JdbcTypesComponent.scala
@@ -250,25 +250,20 @@ trait JdbcTypesComponent extends RelationalTypesComponent { self: JdbcProfile =>
val msb = uuid.getMostSignificantBits
val lsb = uuid.getLeastSignificantBits
val buff = new Array[Byte](16)
- var i = 0
- while(i < 8) {
- buff(i) = ((msb >> (8 * (7 - i))) & 255).toByte;
- buff(8 + i) = ((lsb >> (8 * (7 - i))) & 255).toByte;
- i += 1
+ for (i <- 0 until 8) {
+ buff(i) = ((msb >> (8 * (7 - i))) & 255).toByte
+ buff(8 + i) = ((lsb >> (8 * (7 - i))) & 255).toByte
}
buff
}
def fromBytes(data: Array[Byte]) = if(data eq null) null else {
var msb = 0L
var lsb = 0L
- var i = 0
- while(i < 8) {
+ for (i <- 0 until 8) {
msb = (msb << 8) | (data(i) & 0xff)
- i += 1
}
- while(i < 16) {
+ for (i <- 8 until 16) {
lsb = (lsb << 8) | (data(i) & 0xff)
- i += 1
}
new UUID(msb, lsb)
}

0 comments on commit 86a2e76

Please sign in to comment.