Adds preconditions checks similar to what is available in Guava

As requested, here are the preconditions checks and accompanying tests. Will migrate our code to use these once accepted.
s/precondition/check/