Minor optimizations in Java classes.