Optimize ATNConfigSet getOrAdd

better approximate Java's getOrAdd performance by only looping through the set
if it contains the target