-
Notifications
You must be signed in to change notification settings - Fork 1
HeadSeq
laforge49 edited this page Jul 31, 2011
·
2 revisions
Use HeadSeq when you want to restrict a sequence with an upper limit on the keys. HeadSeq[K, V] subclasses Sequence[K, V] and its constructor takes two parameters: (1) the Sequence[K, V] to be wrapped and the limit: K.
Test code.
val alphabet = new java.util.TreeMap[Int, String]
alphabet.put(8, "Apple")
alphabet.put(22, "Boy")
alphabet.put(5, "Cat")
val navMap = new NavMapSeq(alphabet)
val head = new HeadSeq(navMap, 22)
Future(head, Loop((key: Int, value: String) => println(key + " " + value)))
Output.
5 Cat
8 Apple