diff options
author | Alex Blewitt | 2016-04-19 10:35:21 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-04-19 17:35:54 +0000 |
commit | 2114f6b108763ff027fe0936e1f7b4d7e9cc655c (patch) | |
tree | afd55872d8d3dae5de15300ef63cc6acffdc6e92 /cross | |
parent | 10ba077124e266fb7cfa661241d044a3ee91e0d3 (diff) | |
download | org.eclipse.cdt-2114f6b108763ff027fe0936e1f7b4d7e9cc655c.tar.gz org.eclipse.cdt-2114f6b108763ff027fe0936e1f7b4d7e9cc655c.tar.xz org.eclipse.cdt-2114f6b108763ff027fe0936e1f7b4d7e9cc655c.zip |
Bug 491984 - Replace .equals("") with .isEmpty()
In many cases a String's empty status is tested with `.equals("")`.
However, Java 1.6 added `.isEmpty()` which can be more efficient since
it compares the internal length parameter only for testing. Replace
code using the `.isEmpty()` variant instead.
Some tests for `"".equals(expr)` can be replaced with `expr.isEmpty()`
where it is already known that the `expr` is not null; however,
these have to be reviewed on a case-by-case basis.
Change-Id: I3c6af4d8b7638e757435914ac76cb3a67899a5fd
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Diffstat (limited to 'cross')
3 files changed, 6 insertions, 6 deletions
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RSEHelper.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RSEHelper.java index e2ba3460869..2e7dcf70fe4 100644 --- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RSEHelper.java +++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RSEHelper.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2009, 2015 MontaVista Software, Inc. and others. + * Copyright (c) 2009, 2016 MontaVista Software, Inc. and others. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -249,7 +249,7 @@ public class RSEHelper { String remoteCommand = realRemoteCommand + CMD_DELIMITER + EXIT_CMD; - if (!prelaunchCmd.trim().equals("")) //$NON-NLS-1$ + if (!prelaunchCmd.trim().isEmpty()) remoteCommand = prelaunchCmd + CMD_DELIMITER + remoteCommand; IShellService shellService; @@ -299,7 +299,7 @@ public class RSEHelper { String remoteCommand = realRemoteCommand + CMD_DELIMITER + EXIT_CMD; - if (!prelaunchCmd.trim().equals("")) //$NON-NLS-1$ + if (!prelaunchCmd.trim().isEmpty()) remoteCommand = prelaunchCmd + CMD_DELIMITER + remoteCommand; IShellService shellService = null; diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/launching/RemoteGdbLaunchDelegate.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/launching/RemoteGdbLaunchDelegate.java index c225ec40891..8721e16403f 100644 --- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/launching/RemoteGdbLaunchDelegate.java +++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/launching/RemoteGdbLaunchDelegate.java @@ -95,7 +95,7 @@ public class RemoteGdbLaunchDelegate extends GdbLaunchDelegate { IRemoteConnectionConfigurationConstants.ATTR_PRERUN_COMMANDS, ""); //$NON-NLS-1$ - if (arguments != null && !arguments.equals("")) //$NON-NLS-1$ + if (arguments != null && !arguments.isEmpty()) commandArguments += " " + arguments; //$NON-NLS-1$ monitor.setTaskName(Messages.RemoteRunLaunchDelegate_9); diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java index 9dea8f8de69..6e4f12e59e9 100644 --- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java +++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/tabs/RemoteCDSFMainTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 PalmSource, Inc. and others. + * Copyright (c) 2006, 2016 PalmSource, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -146,7 +146,7 @@ public class RemoteCDSFMainTab extends CMainTab { int currentSelection = connectionCombo.getSelectionIndex(); String connection_name = currentSelection >= 0 ? connectionCombo .getItem(currentSelection) : ""; //$NON-NLS-1$ - if (connection_name.equals("")) { //$NON-NLS-1$ + if (connection_name.isEmpty()) { setErrorMessage(CONNECTION_TEXT_ERROR); retVal = false; } |