MCPcopy Create free account
hub / github.com/antlr/codebuff / toArrayImpl

Method toArrayImpl

output/java_guava/1.4.19/ObjectArrays.java:152–162  ·  view source on GitHub ↗

Returns an array containing all of the elements in the specified collection; the runtime type of the returned array is that of the specified array. If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array

(Collection<?> c, T[] array)

Source from the content-addressed store, hash-verified

150
151
152 static <T> T[] toArrayImpl(Collection<?> c, T[] array) {
153 int size = c.size();
154 if (array.length < size) {
155 array = newArray(array, size);
156 }
157 fillArray(c, array);
158 if (array.length > size) {
159 array[size] = null;
160 }
161 return array;
162 }
163
164 /**
165 * Implementation of {@link Collection#toArray(Object[])} for collections backed by an object

Callers 2

toArrayMethod · 0.95
standardToArrayMethod · 0.95

Calls 4

newArrayMethod · 0.95
fillArrayMethod · 0.95
sizeMethod · 0.65
checkPositionIndexesMethod · 0.45

Tested by

no test coverage detected