Skip to content

Commit

Permalink
[SHRINKRES-320] Remove redundant if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
petrberan committed Feb 8, 2024
1 parent 3ab21c6 commit 67e5c5c
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,8 @@ public boolean equals(Object obj) {
return false;
PackagingType other = (PackagingType) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
return other.id == null;
} else return id.equals(other.id);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,7 @@ public boolean equals(final Object obj) {
} else if (!classifier.equals(other.classifier)) {
return false;
}
if (!packaging.equals(other.packaging)) {
return false;
}
return true;
return packaging.equals(other.packaging);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,8 @@ public boolean equals(final Object obj) {
return false;
}
if (groupId == null) {
if (other.groupId != null) {
return false;
}
} else if (!groupId.equals(other.groupId)) {
return false;
}
return true;
return other.groupId == null;
} else return groupId.equals(other.groupId);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,7 @@ public boolean accepts(final MavenDependency dependency, final List<MavenDepende
if (dependency == null) {
return false;
}

if (allowedScopes.contains(dependency.getScope())) {
return true;
}

return false;
return allowedScopes.contains(dependency.getScope());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ public static void notEmpty(final Collection<?> collection, final String message
* @return {@code true} if specified String is null or empty, {@code false} otherwise
*/
public static boolean isNullOrEmpty(final String string) {
if (string == null || string.length() == 0) {
return true;
}
return false;
return (string == null || string.length() == 0);
}

/**
Expand All @@ -92,10 +89,7 @@ public static boolean isNullOrEmpty(final String string) {
* @return {@code true} if specified String is null or empty, {@code false} otherwise
*/
public static boolean isNullOrEmptyOrQuestionMark(final String string) {
if (string == null || string.length() == 0 || "?".equals(string)) {
return true;
}
return false;
return (string == null || string.length() == 0 || "?".equals(string));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,8 @@ public boolean equals(Object obj) {
}
MavenDependencyImpl other = (MavenDependencyImpl) obj;
if (delegate == null) {
if (other.delegate != null) {
return false;
}
} else if (!delegate.equals(other.delegate)) {
return false;
}
return true;
return other.delegate == null;
} else return delegate.equals(other.delegate);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ public static void notEmpty(final Collection<?> collection, final String message
* @return {@code true} if specified String is null or empty, {@code false} otherwise
*/
public static boolean isNullOrEmpty(final String string) {
if (string == null || string.length() == 0) {
return true;
}
return false;
return (string == null || string.length() == 0);
}

/**
Expand All @@ -101,10 +98,7 @@ public static boolean isNullOrEmpty(final String string) {
* @return {@code true} if specified String is null or empty, {@code false} otherwise
*/
public static boolean isNullOrEmptyOrQuestionMark(final String string) {
if (string == null || string.length() == 0 || "?".equals(string)) {
return true;
}
return false;
return (string == null || string.length() == 0 || "?".equals(string));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,7 @@ private static class DepthFilter implements MavenResolutionFilter {
@Override
public boolean accepts(MavenDependency dependency, List<MavenDependency> dependenciesForResolution,
List<MavenDependency> dependencyAncestors) {

if (dependencyAncestors != null && dependencyAncestors.size() > depth) {
return false;
}

return true;
return (dependencyAncestors == null || dependencyAncestors.size() <= depth);
}
}
}

0 comments on commit 67e5c5c

Please sign in to comment.