blob: 0242e601044d24c70406177dac1dd0a4cef5f69f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
object Test extends App {
import collection.mutable.ListBuffer
def newLB = ListBuffer('a, 'b, 'c, 'd, 'e)
val lb0 = newLB
try {
lb0.insert(-1, 'x)
} catch {
case ex: IndexOutOfBoundsException => println(ex)
}
val lb1 = newLB
try {
lb1.insertAll(-2, Array('x, 'y, 'z))
} catch {
case ex: IndexOutOfBoundsException => println(ex)
}
val lb2 = newLB
try {
lb2.update(-3, 'u)
} catch {
case ex: IndexOutOfBoundsException => println(ex)
}
}
|