Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-05-24 11:36:11 -0400
committerLars Vogel2019-06-11 07:01:32 -0400
commit900b243c57236b0489cfa2f390c5e96016f6b306 (patch)
treeb800ab6fba31df8f2ae061ae30739172bf81cec9
parent5985742bd756f3d5eabe4c512f4c398301e2593f (diff)
downloadeclipse.platform.team-900b243c57236b0489cfa2f390c5e96016f6b306.tar.gz
eclipse.platform.team-900b243c57236b0489cfa2f390c5e96016f6b306.tar.xz
eclipse.platform.team-900b243c57236b0489cfa2f390c5e96016f6b306.zip
Use isEmpty() instead of size()==0 where possible
Change-Id: I591baac7b623f8ed3681a12471ffe6438a13175f Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java2
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java2
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java2
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java4
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/OrderedMatching.java4
15 files changed, 17 insertions, 17 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
index 3ae8cafdc..815798502 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
@@ -517,7 +517,7 @@ public class Utilities {
public static boolean validateResources(IResource[] resources, Shell shell, String title) {
// get all readonly files
List<IResource> readOnlyFiles= getReadonlyFiles(resources);
- if (readOnlyFiles.size() == 0)
+ if (readOnlyFiles.isEmpty())
return true;
// get timestamps of readonly files before validateEdit
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
index 708bbd2cd..1604f2804 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
@@ -135,7 +135,7 @@ public class Activator implements BundleActivator {
}
}
- FrameworkLogEntry[] children = childlist.size() == 0 ? null
+ FrameworkLogEntry[] children = childlist.isEmpty() ? null
: childlist.toArray(new FrameworkLogEntry[childlist.size()]);
return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(),
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
index 4fdaba22a..a1b3963dc 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/proxy/win32/winhttp/StaticProxyConfig.java
@@ -106,7 +106,7 @@ public class StaticProxyConfig {
}
private IProxyData[] getUniversalProxiesData() {
- if (universalProxies.size() == 0) {
+ if (universalProxies.isEmpty()) {
return new IProxyData[0];
}
IProxyData[] data = new IProxyData[KNOWN_TYPES.length];
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
index b6473385a..63c86bd0c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
@@ -248,7 +248,7 @@ public abstract class ProjectSetCapability {
existingProjects.add(eachProj);
}
}
- if (existingProjects.size() == 0)
+ if (existingProjects.isEmpty())
return projects;
// Confirm the overwrite
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
index 85d9aff4b..7a61e6da0 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
@@ -713,7 +713,7 @@ public class CVSProviderPlugin extends Plugin {
public void setProxyAuth(String proxyUser, String proxyPass) {
Map authInfo = getAuthInfo();
- if (authInfo.size()==0) {
+ if (authInfo.isEmpty()) {
authInfo = new java.util.HashMap(4);
}
if (proxyUser != null) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 754c44908..0e738abf8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -357,7 +357,7 @@ public class CVSTeamProvider extends RepositoryProvider {
// commit files that changed from binary to text
// NOTE: The files are committed as text with conversions even if the
// resource sync info still says "binary".
- if (filesToCommitAsText.size() != 0) {
+ if (!filesToCommitAsText.isEmpty()) {
Session session1 = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
session1.open(Policy.subMonitorFor(monitor1, 1), true /* open for modification */);
try {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
index 6d199da8c..3084fb890 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
@@ -227,7 +227,7 @@ public class LogListener extends CommandOutputListener {
CVSTag tag = new CVSTag(CVSTag.HEAD_BRANCH, CVSTag.HEAD_REVISION, CVSTag.HEAD);
thisRevisionBranches.add(tag);
} else {
- if ( thisRevisionBranches.size() == 0) {
+ if ( thisRevisionBranches.isEmpty()) {
CVSTag cvsTag = new CVSTag(CVSTag.UNKNOWN_BRANCH, branchRevision, CVSTag.BRANCH);
thisRevisionBranches.add(cvsTag);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java
index 46747a6c2..c93f23583 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SynchronizerSyncInfoCache.java
@@ -311,7 +311,7 @@ import org.eclipse.team.internal.ccvs.core.util.Util;
cachedResources.add(resource);
}
- if (cachedResources.size() != 0){
+ if (!cachedResources.isEmpty()){
IResource[] resources = folder.members(true);
IResource[] cachedResourcesArray = cachedResources.toArray(new IResource[cachedResources.size()]);
IResource[]finalResources = new IResource[resources.length + cachedResourcesArray.length];
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
index 5b2485847..3329846d8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
@@ -1673,7 +1673,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Assume that some revisions have been found
boolean revisionsFound = true;
- if (finalCategories.size() == 0){
+ if (finalCategories.isEmpty()){
//no revisions found for the current mode, so add a message category
finalCategories.add(getErrorMessage());
revisionsFound = false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
index 4b1d51fe8..3cc08cf6e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
@@ -325,7 +325,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
}
}
// Handle the case where there are no problem status
- if (problems.size() == 0) {
+ if (problems.isEmpty()) {
if (exception == null) return;
handle(exception, getErrorTitle(), null);
return;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java
index 87dd5dcc2..cce336271 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java
@@ -197,7 +197,7 @@ public class WorkspaceCommitOperation extends CVSSubscriberOperation {
makeOutgoing(makeOutgoing.toArray(new SyncInfo[makeInSync.size()]), Policy.subMonitorFor(monitor, 25));
}
- if (additions.size() != 0) {
+ if (!additions.isEmpty()) {
add(project, additions.toArray(new IResource[0]), Policy.subMonitorFor(monitor, 50));
}
commit(project, commits.toArray(new IResource[commits.size()]), Policy.subMonitorFor(monitor, 100));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java
index fa2e49126..9c0df66ec 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java
@@ -165,7 +165,7 @@ public class ModeWizard extends ResizableWizard {
try {
final List<IStatus> messages = new ArrayList<>();
final List changes= fPage.getChanges();
- if (changes.size() == 0)
+ if (changes.isEmpty())
return true;
final String comment = fPage.getComment(getShell());
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
index 00f2c71c8..0781e390c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
@@ -885,7 +885,7 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
finalCategories.add(tempCategories[i]);
}
- if (finalCategories.size() == 0){
+ if (finalCategories.isEmpty()){
//no revisions found for the current mode, so add a message category
finalCategories.add(getErrorMessage());
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
index 6b9513c55..b3e010c0d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/CopyToClipboardAction.java
@@ -215,7 +215,7 @@ class CopyToClipboardAction extends SelectionListenerAction {
// contribution/ on them.
List selectedResources = getSelectedResources();
List selectedNonResources = getSelectedNonResources();
- if (selectedResources.size() > 0 && selectedNonResources.size() == 0) {
+ if (selectedResources.size() > 0 && selectedNonResources.isEmpty()) {
boolean projSelected = selectionIsOfType(IResource.PROJECT);
boolean fileFoldersSelected = selectionIsOfType(IResource.FILE | IResource.FOLDER);
if (!projSelected && !fileFoldersSelected)
@@ -237,7 +237,7 @@ class CopyToClipboardAction extends SelectionListenerAction {
return false;
}
return true;
- } else if (selectedNonResources.size() > 0 && selectedResources.size() == 0) {
+ } else if (selectedNonResources.size() > 0 && selectedResources.isEmpty()) {
return true;
}
return false;
diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/OrderedMatching.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/OrderedMatching.java
index 6b362f7c1..cb2ff4029 100644
--- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/OrderedMatching.java
+++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/OrderedMatching.java
@@ -69,9 +69,9 @@ public class OrderedMatching extends AbstractMatching {
// perform unordered matching on attributes
// this updates fDT and fDT_Matchings
if (xc_attrsAL.size() > 0 || yc_attrsAL.size() > 0) {
- if (xc_attrsAL.size() == 0)
+ if (xc_attrsAL.isEmpty())
distance += yc_attrsAL.size();
- else if (yc_attrsAL.size() == 0)
+ else if (yc_attrsAL.isEmpty())
distance += xc_attrsAL.size();
else {
//unorderedMatch(x, y, xc_attrs, yc_attrs);

Back to the top