Buggy code:
private int nextIndex = 0 ; private boolean canRemove = false ; FlatMapIterator ( Flat3Map < K , V > parent ) { } public boolean hasNext ( ) { } public K next ( ) { } public void remove ( ) { } public K getKey ( ) { } public V getValue ( ) { } public V setValue ( V value ) { } public void reset ( ) { } public String toString ( ) { if ( canRemove ) { return ( ( ( "Iterator[" + ( getKey ( ) ) ) + "=" ) + ( getValue ( ) ) ) + "]" ; } return "Iterator[]" ; } } public Set < Map . Entry < K , V > > entrySet ( ) { } static class EntrySet < K , V > extends AbstractSet < Map . Entry < K , V > > { private final Flat3Map < K , V > parent ; EntrySet ( Flat3Map < K , V > parent ) { } public int size ( ) { } public void clear ( ) { } public boolean remove ( Object obj ) { } public Iterator < Map . Entry < K , V > > iterator ( ) { } } abstract static class EntryIterator < K , V > implements Map . Entry < K , V > { private final Flat3Map < K , V > parent ; private int nextIndex = 0 ; protected boolean canRemove = false ; public EntryIterator ( Flat3Map < K , V > parent ) { } public boolean hasNext ( ) { } public Map . Entry < K , V > nextEntry ( ) { } public void remove ( ) { } public K getKey ( ) { } public V getValue ( ) { } public V setValue ( V value ) { } } static class EntrySetIterator < K , V > extends Flat3Map . EntryIterator < K , V > implements Iterator < Map . Entry < K , V > > { EntrySetIterator ( Flat3Map < K , V > parent ) { } public Map . Entry < K , V > next ( ) { } public boolean equals ( Object obj ) { } public int hashCode ( ) { } public String toString ( ) { if ( canRemove ) { return ( ( getKey ( ) ) + "=" ) + ( getValue ( ) ) ; } return "" ; } } public Set < K > keySet ( ) { } static class KeySet < K > extends AbstractSet < K > { private final Flat3Map < K , ? > parent ; KeySet ( Flat3Map < K , ? > parent ) { } public int size ( ) { } public void clear ( ) { } public boolean contains ( Object key ) { } public boolean remove ( Object key ) { } public Iterator < K > iterator ( ) { } } static class KeySetIterator < K > extends Flat3Map . EntryIterator < K , Object > implements Iterator < K > { @ SuppressWarnings ( "unchecked" ) KeySetIterator ( Flat3Map < K , ? > parent ) { } public K next ( ) { } } public Collection < V > values ( ) { } static class Values < V > extends AbstractCollection < V > { private final Flat3Map < ? , V > parent ; Values ( Flat3Map < ? , V > parent ) { } public int size ( ) { } public void clear ( ) { } public boolean contains ( Object value ) { } public Iterator < V > iterator ( ) { } } static class ValuesIterator < V > extends Flat3Map . EntryIterator < Object , V > implements Iterator < V > { @ SuppressWarnings ( "unchecked" ) ValuesIterator ( Flat3Map < ? , V > parent ) { } public V next ( ) { } } private void writeObject ( ObjectOutputStream out ) throws IOException { } @ SuppressWarnings ( "unchecked" ) private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { } @ SuppressWarnings ( "unchecked" ) public Flat3Map < K , V > clone ( ) { } public boolean equals ( Object obj ) { } public int hashCode ( ) { } public String toString ( ) { if ( ( delegateMap ) != null ) { return delegateMap . toString ( ) ; } if ( ( size ) == 0 ) { return "{}" ; } <START_BUG> StringBuffer buf = new StringBuffer ( 128 ) ; <END_BUG> buf . append ( '{' ) ; switch ( size ) { case 3 : buf . append ( ( ( key3 ) == ( this ) ? "(this<seq2seq4repair_space>Map)" : key3 ) ) ; buf . append ( '=' ) ; buf . append ( ( ( value3 ) == ( this ) ? "(this<seq2seq4repair_space>Map)" : value3 ) ) ; buf . append ( ',' ) ; case 2 : buf . append ( ( ( key2 ) == ( this ) ? "(this<seq2seq4repair_space>Map)" : key2 ) ) ; buf . append ( '=' ) ; buf . append ( ( ( value2 ) == ( this ) ? "(this<seq2seq4repair_space>Map)" : value2 ) ) ; buf . append ( ',' ) ; case 1 : buf . append ( ( ( key1 ) == ( this ) ? "(this<seq2seq4repair_space>Map)" : key1 ) ) ; buf . append ( '=' ) ; buf . append ( ( ( value1 ) == ( this ) ? "(this<seq2seq4repair_space>Map)" : value1 ) ) ; } buf . append ( '}' ) ; return buf . toString ( ) ; } }

Fix:
StringBuilder buf = new StringBuilder ( 128 ) ;