Skip to content

Commit

Permalink
refactor: org.openrewrite.staticanalysis.IsEmptyCallOnCollections
Browse files Browse the repository at this point in the history
  • Loading branch information
Bananeweizen committed Jan 19, 2025
1 parent 1e3bbd2 commit 39c643c
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static ICheckConfiguration getDefaultCheckConfiguration() {
return sDefaultCheckConfig;
} else if (sDefaultBuiltInConfig != null) {
return sDefaultBuiltInConfig;
} else if (sConfigurations.size() > 0) {
} else if (!sConfigurations.isEmpty()) {
return sConfigurations.get(0);
} else {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static void write(OutputStream out, List<Module> modules, ICheckConfigura
// find the root module (Checker)
// the root module is the only module that has no parent
List<Module> rootModules = getChildModules(null, modules);
if (rootModules.size() < 1) {
if (rootModules.isEmpty()) {
throw new CheckstylePluginException(Messages.errorNoRootModule);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void store() throws CheckstylePluginException {

@Override
public boolean isDirty() {
if (mDeletedConfigurations.size() > 0) {
if (!mDeletedConfigurations.isEmpty()) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void store() throws CheckstylePluginException {

@Override
public boolean isDirty() {
if (mDeletedConfigurations.size() > 0) {
if (!mDeletedConfigurations.isEmpty()) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static IProjectConfiguration getConfiguration(IProject project)
*/
public static boolean isCheckConfigInUse(ICheckConfiguration checkConfig)
throws CheckstylePluginException {
return getProjectsUsingConfig(checkConfig).size() > 0;
return !getProjectsUsingConfig(checkConfig).isEmpty();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,13 @@ public boolean performOk() {
.getString(CheckstyleUIPluginPrefs.PREF_ASK_BEFORE_REBUILD);

boolean rebuild = MessageDialogWithToggle.ALWAYS.equals(promptRebuildPref)
&& (needRebuildAllProjects || projectsToBuild.size() > 0);
&& (needRebuildAllProjects || !projectsToBuild.isEmpty());

//
// Prompt for rebuild
//
if (MessageDialogWithToggle.PROMPT.equals(promptRebuildPref)
&& (needRebuildAllProjects || projectsToBuild.size() > 0)) {
&& (needRebuildAllProjects || !projectsToBuild.isEmpty())) {

MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(getShell(),
Messages.CheckstylePreferencePage_titleRebuild,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void setFileSets(List<FileSet> fileSets) throws CheckstylePluginException
mFileSets = fileSets;

ICheckConfiguration config = null;
if (mFileSets.size() > 0) {
if (!mFileSets.isEmpty()) {
config = (mFileSets.get(0)).getCheckConfig();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private Boolean isReturnStatementTrue(final Statement node) {
// the return statement might be wrapped in a block statement
@SuppressWarnings("unchecked")
final List<Statement> statements = ((Block) node).statements();
if (statements.size() > 0) {
if (!statements.isEmpty()) {
return isReturnStatementTrue(statements.get(0));
}
}
Expand Down

0 comments on commit 39c643c

Please sign in to comment.