@since 2.5.0
(Iterable<T> collections)
| 108 | * @since 2.5.0 |
| 109 | */ |
| 110 | public static <T> List<List<T>> tails(Iterable<T> collections) { |
| 111 | List<T> copy = DefaultGroovyMethods.toList(collections); |
| 112 | List<List<T>> result = new ArrayList<>(); |
| 113 | for (int i = 0; i <= copy.size(); i++) { |
| 114 | List<T> next = copy.subList(i, copy.size()); |
| 115 | result.add(next); |
| 116 | } |
| 117 | return result; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Finds all non-empty subsequences of a list. |