(Object[] array)
| 146 | */ |
| 147 | // TODO(adonovan): move this somewhere more appropriate. |
| 148 | static <T> ImmutableList<T> wrapImmutable(Object[] array) { |
| 149 | // Construct an ImmutableList that shares the array. |
| 150 | // ImmutableList relies on the implementation of Collection.toArray |
| 151 | // not subsequently modifying the returned array. |
| 152 | return ImmutableList.copyOf( |
| 153 | new AbstractCollection<T>() { |
| 154 | @Override |
| 155 | public Object[] toArray() { |
| 156 | return array; |
| 157 | } |
| 158 | |
| 159 | @Override |
| 160 | public int size() { |
| 161 | return array.length; |
| 162 | } |
| 163 | |
| 164 | @Override |
| 165 | public Iterator<T> iterator() { |
| 166 | throw new UnsupportedOperationException(); |
| 167 | } |
| 168 | }); |
| 169 | } |
| 170 | |
| 171 | /** Returns a Tuple containing n consecutive repeats of this tuple. */ |
| 172 | abstract Tuple repeat(StarlarkInt n) throws EvalException; |
no test coverage detected