|
Scala example source code file (t2813.2.scala)
The Scala t2813.2.scala source code
import java.util.LinkedList
import collection.JavaConversions._
object Test extends App {
def assertListEquals[A](expected: List[A], actual: Seq[A]) {
assert(expected.sameElements(actual),
"Expected list to contain " + expected.mkString("[", ", ", "]") +
", but was " + actual.mkString("[", ", ", "]"))
}
def addAllOfNonCollectionWrapperAtZeroOnEmptyLinkedList() {
val l = new LinkedList[Int]
l.addAll(0, List(1, 2))
assertListEquals(List(1, 2), l)
}
def addAllOfNonCollectionWrapperAtZeroOnLinkedList() {
val l = new LinkedList[Int] + 1 + 2
l.addAll(0, List(10, 11))
assertListEquals((List(10, 11, 1, 2)), l)
}
def addAllOfCollectionWrapperAtZeroOnLinkedList() {
val l = new LinkedList[Int] + 1 + 2
l.addAll(0, new LinkedList[Int] + 10 + 11)
assertListEquals((List(10, 11, 1, 2)), l)
}
def addAllOfCollectionWrapperAtZeroOnEmptyLinkedList() {
val l = new LinkedList[Int]
l.addAll(0, new LinkedList[Int] + 10 + 11)
assertListEquals((List(10, 11)), l)
}
addAllOfNonCollectionWrapperAtZeroOnEmptyLinkedList
addAllOfNonCollectionWrapperAtZeroOnLinkedList
addAllOfCollectionWrapperAtZeroOnEmptyLinkedList
addAllOfCollectionWrapperAtZeroOnLinkedList
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala t2813.2.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.