But Last

Given a [!scala]List[Int][/!][!java|python]recursive list[/!], return the list containing every elements but the last one. You can assume that the list is not empty.

Your solution should be linear in time.