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

Method strip

output/java/1.4.14/Interpreter.java:1060–1073  ·  view source on GitHub ↗

Return a new list without null values.

(InstanceScope scope, Object v)

Source from the content-addressed store, hash-verified

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