Also, genetic diversity can increase in bacteria the same way it increases in vertebrates. Sexual recombination occurs though conjugation of bacteria. In some cases, different species can exchange genetic material. This is how the "nylon gene" so quickly spread into bacterial populations.
Contrary to early reports, the mutation did not appear only after nylon was invented; evidence from various natural populations shows that the mutation occurs from natural homologues, and not as a special response to available nylon (confirming the work of Luria and Delbruck which showed that mutations appear randomly, and not in response to need).
Initially, it was thought to have been an entirely new gene, produced by a frameshift mutation, but subsequent works has shown that it evolved by mutation of existing genes. Where nylon oligomer was present (such as in waste ponds of nylon factories) the gene spread rapidly by natural selection, aided by conjugation.