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

Method first

output/java8/1.4.15/Interpreter.java:946–957  ·  view source on GitHub ↗

Return the first attribute if multi-valued, or the attribute itself if single-valued. This method is used for rendering expressions of the form .

(InstanceScope scope, Object v)

Source from the content-addressed store, hash-verified

944 */
945
946 public Object first(InstanceScope scope, Object v) {
947 if ( v==null ) return null;
948 Object r = v;
949 v = convertAnythingIteratableToIterator(scope, v);
950 if ( v instanceof Iterator ) {
951 Iterator<?> it = (Iterator<?>)v;
952 if ( it.hasNext() ) {
953 r = it.next();
954 }
955 }
956 return r;
957 }
958
959 /**
960 * Return the last attribute if multi-valued, or the attribute itself if

Callers 1

_execMethod · 0.95

Calls 3

nextMethod · 0.65
hasNextMethod · 0.45

Tested by

no test coverage detected