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

Method writeIterator

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

Source from the content-addressed store, hash-verified

719 }
720
721 protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException {
722 if ( o==null ) return 0;
723 int n = 0;
724 Iterator<?> it = (Iterator<?>)o;
725 String separator = null;
726 if ( options!=null ) separator = options[Option.SEPARATOR.ordinal()];
727 boolean seenAValue = false;
728 while ( it.hasNext() ) {
729 Object iterValue = it.next();
730 // Emit separator if we're beyond first value
731 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
732 if ( needSeparator ) n += out.writeSeparator(separator);
733 int nw = writeObject(out, scope, iterValue, options);
734 if ( nw>0) seenAValue = true;
735 n += nw;
736 }
737 return n;
738 }
739
740 protected int writePOJO(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException {
741 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