MCPcopy Index your code
hub / github.com/antlr/codebuff / strip

Method strip

output/java8/1.4.12/Interpreter.java:1013–1026  ·  view source on GitHub ↗

Return a new list without null values.

(InstanceScope scope, Object v)

Source from the content-addressed store, hash-verified

1011 /** Return a new list without {@code null} values. */
1012
1013 public Object strip(InstanceScope scope, Object v) {
1014 if ( v==null ) return null;
1015 v = convertAnythingIteratableToIterator(scope, v);
1016 if ( v instanceof Iterator ) {
1017 List<Object> a = new ArrayList<Object>();
1018 Iterator<?> it = (Iterator<?>)v;
1019 while ( it.hasNext() ) {
1020 Object o = it.next();
1021 if ( o!=null ) a.add(o);
1022 }
1023 return a;
1024 }
1025 return v; // strip(x)==x when x single-valued attribute
1026 }
1027
1028 /**
1029 * Return a list with the same elements as {@code v} but in reverse order.

Callers 1

_execMethod · 0.95

Calls 4

nextMethod · 0.65
addMethod · 0.65
hasNextMethod · 0.45

Tested by

no test coverage detected