google / google/error-prone

Check for redundant Collection.contains calls.

Open
#913 2 comments 2 reactions 0 assignees View on GitHub
Type-NewCheck
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

Could Error prone check for a Collection.contains call followed by an immediate Collection.remove call?

I see a fair amount of
```java
if (myList.contains(value)) {
myList.remove(value);
// Do something.
}
```
which could be
```java
if (myList.remove(value)) {
// Do something.
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.