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

Method strip

output/java/1.4.17/Interpreter.java:1066–1079  ·  view source on GitHub ↗

Return a new list without null values.

(InstanceScope scope, Object v)

Source from the content-addressed store, hash-verified

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