As a brief note today, I was working on a Java/Android application recently, and I needed a “tail” function when I was working on a Java list. What I mean by that is that Scala has a
tail function that returns all elements of the list except for the head element, like this:
scala> val x = List(1,2,3,4) x: List[Int] = List(1, 2, 3, 4) scala> x.tail res1: List[Int] = List(2, 3, 4) //head element removed
and I wanted the same thing in Java.