Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code quality fix - Collection.isEmpty() should be used to test for emptiness. #47

Merged
merged 1 commit into from
Feb 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public ConsoleAnnotator newInstance(Object context) {
return null;
}
List<FoundFailureCause> foundFailureCauses = action.getFoundFailureCauses();
if (foundFailureCauses.size() < 1) {
if (foundFailureCauses.isEmpty()) {
return null;
}
return new IndicationAnnotator(foundFailureCauses);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ public void removeBuildfailurecause(AbstractBuild build) throws Exception {
*/
private void addFailureCausesToDBObject(DBObject object, List<FailureCauseStatistics> failureCauseStatisticsList)
throws UnknownHostException, AuthenticationException {
if (failureCauseStatisticsList != null && failureCauseStatisticsList.size() > 0) {
if (failureCauseStatisticsList != null && !failureCauseStatisticsList.isEmpty()) {
List<DBObject> failureCauseStatisticsObjects = new LinkedList<DBObject>();

for (FailureCauseStatistics failureCauseStatistics : failureCauseStatisticsList) {
Expand All @@ -1036,7 +1036,7 @@ private void addFailureCausesToDBObject(DBObject object, List<FailureCauseStatis
* @param indications the list of indications to add.
*/
private void addIndicationsToDBObject(DBObject object, List<FoundIndication> indications) {
if (indications != null && indications.size() > 0) {
if (indications != null && !indications.isEmpty()) {
List<DBObject> foundIndicationObjects = new LinkedList<DBObject>();
for (FoundIndication foundIndication : indications) {
DBObject foundIndicationObject = new BasicDBObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public List<String> getCategories() {
*/
@JsonIgnore
public String getCategoriesAsString() {
if (categories == null || categories.size() == 0) {
if (categories == null || categories.isEmpty()) {
return null;
}
StringBuilder builder = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public void doPerformScan(StaplerRequest request, StaplerResponse response)
throws ServletException, IOException, InterruptedException {
checkPermission();
List<AbstractBuild> sodbuilds = getBuilds();
if (sodbuilds.size() > 0) {
if (!sodbuilds.isEmpty()) {
for (AbstractBuild sodbuild : sodbuilds) {
FailureCauseBuildAction fcba = sodbuild.getAction(FailureCauseBuildAction.class);
if (fcba != null) {
Expand Down