MCPcopy Index your code
hub / github.com/antlr/codebuff / writeIterator

Method writeIterator

output/java8/1.4.12/Interpreter.java:702–719  ·  view source on GitHub ↗
(STWriter out, InstanceScope scope, Object o, String[] options)

Source from the content-addressed store, hash-verified

700 }
701
702 protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException {
703 if ( o==null ) return 0;
704 int n = 0;
705 Iterator<?> it = (Iterator<?>)o;
706 String separator = null;
707 if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()];
708 boolean seenAValue = false;
709 while ( it.hasNext() ) {
710 Object iterValue = it.next();
711 // Emit separator if we're beyond first value
712 boolean needSeparator = seenAValue && separator!=null && // we have a separator and (iterValue!=null || // either we have a value options[Option.NULL.ordinal()] !=null); // or no value but null option
713 if ( needSeparator ) n += out.writeSeparator(separator);
714 int nw = writeObject(out, scope, iterValue, options);
715 if ( nw>0) seenAValue = true;
716 n += nw;
717 }
718 return n;
719 }
720
721 protected int writePOJO(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException {
722 String formatString = null;

Callers 1

writeObjectMethod · 0.95

Calls 5

writeObjectMethod · 0.95
ordinalMethod · 0.65
nextMethod · 0.65
writeSeparatorMethod · 0.65
hasNextMethod · 0.45

Tested by

no test coverage detected