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

Method strip

output/java/1.4.13/Interpreter.java:1052–1065  ·  view source on GitHub ↗

Return a new list without null values.

(InstanceScope scope, Object v)

Source from the content-addressed store, hash-verified

1050 /** Return a new list without {@code null} values. */
1051
1052 public Object strip(InstanceScope scope, Object v) {
1053 if ( v==null ) return null;
1054 v = convertAnythingIteratableToIterator(scope, v);
1055 if ( v instanceof Iterator) {
1056 List<Object> a = new ArrayList<Object>();
1057 Iterator<?> it = (Iterator<?>)v;
1058 while ( it.hasNext() ) {
1059 Object o = it.next();
1060 if ( o !=null ) a.add(o);
1061 }
1062 return a;
1063 }
1064 return v; // strip(x)==x when x single-valued attribute
1065 }
1066
1067 /**
1068 * 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