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 /dsf/org.eclipse.cdt.dsf.ui/src | |
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 'dsf/org.eclipse.cdt.dsf.ui/src')
-rw-r--r-- | dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AbstractImageRegistry.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AbstractImageRegistry.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AbstractImageRegistry.java index a0bf5df2263..dfd97ef610e 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AbstractImageRegistry.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AbstractImageRegistry.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Wind River Systems and others. + * Copyright (c) 2007, 2016 Wind River Systems 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 @@ -49,7 +49,7 @@ public abstract class AbstractImageRegistry { * key. */ protected void localImage(String key, String dir, String name) { - if (dir== null || dir.equals(""))//$NON-NLS-1$ + if (dir== null || dir.isEmpty()) fLocations.put(key, new String[] {"icons/" + name}); //$NON-NLS-1$ else fLocations.put(key, new String[] {"icons/" + dir + "/" + name}); //$NON-NLS-1$ //$NON-NLS-2$ @@ -72,7 +72,7 @@ public abstract class AbstractImageRegistry { String[] locations = new String[dirs.length]; for (int i = 0; i < dirs.length; i++) { String dir = dirs[i]; - if (dir== null || dir.equals(""))//$NON-NLS-1$ + if (dir== null || dir.isEmpty()) locations[i] = "icons/" + name; //$NON-NLS-1$ else locations[i] = "icons/" + dir + "/" + name; //$NON-NLS-1$ //$NON-NLS-2$ |