Buggy code:
public class DotGraphIO < E extends ConnectionData > extends AbstractGraphIO < E > { static final String POS = "p=" ; static final char NODE_PREFIX = 'n' ; static final String DISTANCE = "d" ; static final String MAX_SPEED = "s" ; static final char DATA_START = '[' ; static final char DATA_END = ']' ; static final String CONN_SEPARATOR = "->" ; static final char LIST_ITEM_SEPARATOR = ',' ; static final char KEY_VAL_SEPARATOR = '=' ; static final Splitter KEY_VAL_SPLITTER = Splitter . on ( DotGraphIO . KEY_VAL_SEPARATOR ) . trimResults ( ) ; static final Splitter LIST_SPLITTER = Splitter . on ( DotGraphIO . LIST_ITEM_SEPARATOR ) . trimResults ( ) ; static final Splitter CONN_SPLITTER = Splitter . on ( DotGraphIO . CONN_SEPARATOR ) . trimResults ( ) ; static final Splitter DATA_SPLITTER = Splitter . on ( DotGraphIO . DATA_START ) . limit ( 2 ) ; private final Predicate < Connection < ? > > filter ; private final DotGraphIO . ConnectionDataIO < E > dataIO ; DotGraphIO ( DotGraphIO . ConnectionDataIO < E > connectionSerializer , Predicate < Connection < ? > > predicate ) { } @ Override public Graph < E > read ( Reader r ) throws IOException { } @ Override public void write ( Graph < E > graph , Writer writer ) throws IOException { try ( final BufferedWriter out = new BufferedWriter ( writer ) ) { final StringBuilder string = new StringBuilder ( ) ; string . append ( "digraph<seq2seq4repair_space>mapgraph<seq2seq4repair_space>{\n" ) ; int nodeId = 0 ; <START_BUG> final HashMap < Point , Integer > idMap = new HashMap < > ( ) ; <END_BUG> for ( final Point p : graph . getNodes ( ) ) { string . append ( DotGraphIO . NODE_PREFIX ) . append ( nodeId ) . append ( DotGraphIO . DATA_START ) . append ( DotGraphIO . POS ) . append ( "\"" ) . append ( p . x ) . append ( DotGraphIO . LIST_ITEM_SEPARATOR ) . append ( p . y ) . append ( "\"" ) . append ( DotGraphIO . DATA_END ) . append ( System . lineSeparator ( ) ) ; idMap . put ( p , nodeId ) ; nodeId ++ ; } for ( final Connection < E > entry : graph . getConnections ( ) ) { string . append ( DotGraphIO . NODE_PREFIX ) . append ( idMap . get ( entry . from ( ) ) ) . append ( "<seq2seq4repair_space>" ) . append ( DotGraphIO . CONN_SEPARATOR ) . append ( "<seq2seq4repair_space>" ) . append ( DotGraphIO . NODE_PREFIX ) . append ( idMap . get ( entry . to ( ) ) ) ; if ( entry . data ( ) . isPresent ( ) ) { dataIO . write ( string , entry . data ( ) . get ( ) ) ; } string . append ( System . lineSeparator ( ) ) ; } string . append ( '}' ) ; out . append ( string ) ; } } public static DotGraphIO < LengthData > getLengthGraphIO ( ) { } public static DotGraphIO < LengthData > getLengthGraphIO ( Predicate < Connection < ? > > filter ) { } public static DotGraphIO < MultiAttributeData > getMultiAttributeGraphIO ( ) { } public static DotGraphIO < MultiAttributeData > getMultiAttributeGraphIO ( Predicate < Connection < ? > > filter ) { } static Map < String , String > parseDataAsMap ( String line ) { } interface ConnectionDataIO < E extends ConnectionData > { void write ( StringBuilder sb , E data ) { } Optional < E > read ( String data ) { } } enum LengthDataIO implements DotGraphIO . ConnectionDataIO < LengthData > { INSTANCE ( ) { @ Override public void write ( StringBuilder sb , LengthData data ) { } @ Override public Optional < LengthData > read ( String data ) { } } ; } enum MultiAttributeDataIO implements DotGraphIO . ConnectionDataIO < MultiAttributeData > { INSTANCE ( ) { @ Override public void write ( StringBuilder sb , MultiAttributeData data ) { } @ Override public Optional < MultiAttributeData > read ( String data ) { } } ; } }

Fix:
final Map < Point , Integer > idMap = new HashMap < > ( ) ;