private static DNAStrand getOrCreateStrand ( HashMap < Integer , DNAStrand > strands , int color ) { DNAStrand strand = strands . get ( color ) ; if ( strand == null ) { strand = new DNAStrand ( ) ; strand . color = color ; strand . count = 0 ; strands . put ( strand . color , strand ) ; } return strand ; }
Try to get a strand of the given color . Create it if it doesn t exist .