Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.{ArrayList, List => JList}
- class TestFirst {
- implicit def jList2RichList[T](list: JList[T]) = new {
- def head: T = if (list.size > 0) list.get(0) else null.asInstanceOf[T]
- }
- def doTest {
- val jList = new ArrayList[String]()
- jList.add("a")
- jList.add("b")
- println(jList.head)
- val jList2 = new ArrayList[String]()
- println(jList2.head)
- }
- }
Add Comment
Please, Sign In to add comment