Returns every element of a list but its last element.
(List<E> list)
| 2206 | |
| 2207 | /** Returns every element of a list but its last element. */ |
| 2208 | public static <E> List<E> skipLast(List<E> list) { |
| 2209 | return skipLast(list, 1); |
| 2210 | } |
| 2211 | |
| 2212 | /** Returns every element of a list but its last {@code n} elements. */ |
| 2213 | public static <E> List<E> skipLast(List<E> list, int n) { |