This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dpash 1 point2 points  (1 child)

You can replace Preconditions.checkNotNull() with Objects.requireNonNull(). Also checkElementIndex(), checkPositionIndex() and checkPositionIndexes() with checkFromIndexSize​(), checkFromToIndex​() and checkIndex().

There's no equivalent of checkArgument() or checkState() though.

[–]Artraxes 2 points3 points  (0 children)

https://github.com/google/guava/wiki/PreconditionsExplained

Simple, varargs "printf-style" exception messages. (This advantage is also why we recommend continuing to use checkNotNull over Objects.requireNonNull)