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

Method reverse

output/java8/1.4.16/Interpreter.java:1062–1072  ·  view source on GitHub ↗

Return a list with the same elements as v but in reverse order. Note that null values are not stripped out; use reverse(strip(v)) to do that.

(InstanceScope scope, Object v)

Source from the content-addressed store, hash-verified

1060 */
1061
1062 public Object reverse(InstanceScope scope, Object v) {
1063 if ( v==null ) return null;
1064 v = convertAnythingIteratableToIterator(scope, v);
1065 if ( v instanceof Iterator ) {
1066 List<Object> a = new LinkedList<Object>();
1067 Iterator<?> it = (Iterator<?>)v;
1068 while ( it.hasNext() ) a.add(0, it.next());
1069 return a;
1070 }
1071 return v;
1072 }
1073
1074 /**
1075 * Return the length of a multi-valued attribute or 1 if it is a single

Callers 1

_execMethod · 0.95

Calls 4

addMethod · 0.65
nextMethod · 0.65
hasNextMethod · 0.45

Tested by

no test coverage detected