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

Method writeIterator

output/java/1.4.17/Interpreter.java:749–768  ·  view source on GitHub ↗
(STWriter out, InstanceScope scope, Object o, String[] options)

Source from the content-addressed store, hash-verified

747 }
748
749 protected int writeIterator(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException {
750 if ( o==null ) return 0;
751 int n = 0;
752 Iterator<?> it = (Iterator<?>)o;
753 String separator = null;
754 if ( options !=null ) separator = options[Option.SEPARATOR.ordinal()];
755 boolean seenAValue = false;
756 while ( it.hasNext() ) {
757 Object iterValue = it.next();
758 // Emit separator if we're beyond first value
759 boolean needSeparator = seenAValue&& separator !=null && // we have a separator and
760 (iterValue !=null || // either we have a value
761 options[Option.NULL.ordinal()]!=null); // or no value but null option
762 if ( needSeparator ) n += out.writeSeparator(separator);
763 int nw = writeObject(out, scope, iterValue, options);
764 if ( nw>0) seenAValue = true;
765 n += nw;
766 }
767 return n;
768 }
769
770 protected int writePOJO(STWriter out, InstanceScope scope, Object o, String[] options) throws IOException {
771 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