177
178 private static ParsingExpression[] convertToExpressions(@Nonnull Object... elements) {
179 Objects.requireNonNull(elements);
180 if (elements.length <= 0) {181 throw new IllegalArgumentException();
182 }
183
193 }
194
195 public void addToken(Token... tokens) {
196 if (tokens.length <= 0) {197 throw new IllegalArgumentException("at least one token must be given");
198 }
199
A comparison involving the size of a collection or an array was found, which is always guaranteed to be either true or false.
This is a generally frivolous action and may have been caused by a typo. If this was done to prevent certain code from executing or to ensure some code always executes for debugging purposes, remove it. All debugging-related code changes should be cleaned up after their purpose is served.
Consider revisiting the expression to make sure such a comparison was intended.
Certain comparisons don't ever make sense when dealing with the size of a collection or an array's length.
Consider:
someArray.length < 0
The expression above always evaluates to false
since it is impossible for an array to have a negative length.
Similarly, the following comparison is functionally useless:
someCollection.size() >= 0
The usual state of affairs is that collections cannot have negative sizes. It thus makes no sense to explicitly check if the size of a collection is non-negative as has been done here.
Do not perform comparisons that are guaranteed to result in the same value everytime.
if (coll.size() > 24) {
// ...
}
If you need to check for when a collection is empty, you can use the isEmpty()
method to do so:
if (coll.isEmpty()) {
// ...
}