Given a list with N elements [e 0 , e 1 , ..., e N-1 ] (where N is even), returns a list of the N / 2 elements [ (e 0 , e 1 ), (e 2 , e 3 ), ... ].
(final List<E> list)
| 2116 | * [ (e<sub>0</sub>, e<sub>1</sub>), |
| 2117 | * (e<sub>2</sub>, e<sub>3</sub>), ... ]. */ |
| 2118 | public static <E> List<Pair<E, E>> pairs(final List<E> list) { |
| 2119 | return Pair.zip(quotientList(list, 2, 0), |
| 2120 | quotientList(list, 2, 1)); |
| 2121 | } |
| 2122 | |
| 2123 | /** Returns the first value if it is not null, |
| 2124 | * otherwise the second value. |