|
Scala example source code file (bug3232.scala)
The Scala bug3232.scala source code
object Test {
// some maximally sized ranges
val r1 = 0 until Int.MaxValue
val r2 = 1 to Int.MaxValue
val r3 = Int.MinValue to -2
val r4 = Int.MinValue until -1
// some exceptional conditions
val e1 = () => (0 to Int.MaxValue).length
val e2 = () => (5 until 5).last
def main(args: Array[String]): Unit = {
List(r1, r2, r3, r4) foreach (x => assert(x.length == Int.MaxValue))
// exception required
List(e1, e2) foreach { f =>
try { f() ; assert(false) }
catch { case _ => () }
}
}
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala bug3232.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.