private BitVector(Bit[] bits)
{
- this.bits = Objects.requireNonNull(bits);
+ this.bits = Objects.requireNonNull(bits);// do this first to "catch" bits==null before the foreach loop
+ for (Bit bit : bits)
+ if (bit == null)
+ throw new NullPointerException();
}
public static BitVector of(Bit... bits)