MCPcopy Index your code
hub / github.com/bazelbuild/bazel / wrapImmutable

Method wrapImmutable

src/main/java/net/starlark/java/eval/Tuple.java:148–169  ·  view source on GitHub ↗
(Object[] array)

Source from the content-addressed store, hash-verified

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;

Callers 3

getImmutableListMethod · 0.95
getImmutableListMethod · 0.95
getImmutableListMethod · 0.80

Calls 1

copyOfMethod · 0.45

Tested by

no test coverage detected