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

Method strip

output/java8/1.4.14/Interpreter.java:1032–1045  ·  view source on GitHub ↗

Return a new list without null values.

(InstanceScope scope, Object v)

Source from the content-addressed store, hash-verified

1030 /** Return a new list without {@code null} values. */
1031
1032 public Object strip(InstanceScope scope, Object v) {
1033 if ( v==null ) return null;
1034 v = convertAnythingIteratableToIterator(scope, v);
1035 if ( v instanceof Iterator ) {
1036 List<Object> a = new ArrayList<Object>();
1037 Iterator<?> it = (Iterator<?>)v;
1038 while ( it.hasNext() ) {
1039 Object o = it.next();
1040 if ( o!=null ) a.add(o);
1041 }
1042 return a;
1043 }
1044 return v; // strip(x)==x when x single-valued attribute
1045 }
1046
1047 /**
1048 * 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