There are solutions to solve the initialization problem. The JVM guarantees > that an object is consistent after the ctor is run, so you can do the > initialization like this (please note the double {{}}, which is an inline > ctor, this is also often seen for unmodifiable HashSets): > > final OpenBitSet mybits = new OpenBitSet(size) {{ > fastSet(1); fastSet(2);... > }}; >
To complete Uwe's hint: note the object is assigned to a final field -- JVM guarantees publication safety in correlation with final fields or static initializer (which in turn result from class loading spec). If you Google for safe publication you'll find a lot of information about this. Dawid