MCPcopy Create free account
hub / github.com/apache/calcite / of

Method of

core/src/main/java/org/apache/calcite/runtime/ConsList.java:44–53  ·  view source on GitHub ↗

Creates a ConsList. It consists of an element pre-pended to another list. If the other list is mutable, creates an immutable copy.

(E first, List<? extends E> rest)

Source from the content-addressed store, hash-verified

42 * It consists of an element pre-pended to another list.
43 * If the other list is mutable, creates an immutable copy. */
44 public static <E> List<E> of(E first, List<? extends E> rest) {
45 if (rest instanceof ConsList
46 || rest instanceof ImmutableList
47 && !rest.isEmpty()) {
48 //noinspection unchecked
49 return new ConsList<>(first, (List<E>) rest);
50 } else {
51 return ImmutableList.<E>builder().add(first).addAll(rest).build();
52 }
53 }
54
55 private ConsList(E first, List<E> rest) {
56 this.first = first;

Callers 6

testConsMethod · 0.95
makeConsListMethod · 0.95
addMethod · 0.95
registerMethod · 0.95
consMethod · 0.95
funMethod · 0.95

Calls 5

buildMethod · 0.65
addAllMethod · 0.65
addMethod · 0.65
builderMethod · 0.65
isEmptyMethod · 0.45

Tested by 2

testConsMethod · 0.76
makeConsListMethod · 0.76