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

Method toArray

output/java_guava/1.4.17/Chars.java:437–449  ·  view source on GitHub ↗

Copies a collection of Character instances into a new array of primitive char values. Elements are copied from the argument collection as if by collection.toArray(). Calling this method is as thread-safe as calling that method. @param collection a collection of {@code Ch

(Collection<Character> collection)

Source from the content-addressed store, hash-verified

435
436
437 public static char[] toArray(Collection<Character> collection) {
438 if (collection instanceof CharArrayAsList) {
439 return ((CharArrayAsList) collection).toCharArray();
440 }
441 Object[] boxedArray = collection.toArray();
442 int len = boxedArray.length;
443 char[] array = new char[len];
444 for (int i = 0; i < len; i++) {
445 // checkNotNull for GWT (do not optimize)
446 array[i] = (Character) checkNotNull(boxedArray[i]);
447 }
448 return array;
449 }
450
451 /**
452 * Returns a fixed-size list backed by the specified array, similar to

Callers

nothing calls this directly

Calls 2

toCharArrayMethod · 0.45
checkNotNullMethod · 0.45

Tested by

no test coverage detected