Kaydet (Commit) 68fa1410 authored tarafından Noel Grandin's avatar Noel Grandin

java: use isEmpty() instead of "size() == 0"

Change-Id: I23e1038246999b0744d8e9ae83b66fa1f7dafa99
üst 81968336
......@@ -52,7 +52,7 @@ public class IniFile implements Enumeration<String>
public void insertFirstComment(String[] _aList)
{
if (m_aList.size() == 0)
if (m_aList.isEmpty())
{
// can only insert if there is nothing else already in the ini file
for (int i = 0; i < _aList.length; i++)
......
......@@ -153,7 +153,7 @@ public abstract class DescGetter
}
}
if (entryList.size() == 0)
if (entryList.isEmpty())
{
return null;
}
......
......@@ -289,7 +289,7 @@ public class XMLTools {
public void endElement(String name) {
super.endElement(name);
if (wellFormed) {
if (tagStack.size() == 0) {
if (tagStack.isEmpty()) {
wellFormed = false ;
printError("No tags to close (bad closing tag </" + name + ">)") ;
} else {
......@@ -718,7 +718,7 @@ public class XMLTools {
if (!isWellFormed())
log.println("!!! Some errors were found in XML structure") ;
boolean result = tags.size() == 0 && chars.size() == 0 && isWellFormed();
boolean result = tags.isEmpty() && chars.size() == 0 && isWellFormed();
reset();
return result;
}
......
......@@ -218,9 +218,9 @@ public class ScriptMetaData extends ScriptEntry {
if (url != null) {
classPathVec.add(url);
}
}
}
return classPathVec.toArray(new URL[classPathVec.size()]);
return classPathVec.toArray(new URL[classPathVec.size()]);
} catch (Exception e) {
LogUtils.DEBUG("Failed to build class path " + e.toString());
LogUtils.DEBUG(LogUtils.getTrace(e));
......@@ -320,4 +320,4 @@ public class ScriptMetaData extends ScriptEntry {
LogUtils.DEBUG("Creating script url for " + sUrl);
return createURL(sUrl);
}
}
\ No newline at end of file
}
......@@ -284,7 +284,7 @@ public class CommandLineTools {
}
if (scripts != null) {
if (scripts.size() == 0)
if (scripts.isEmpty())
throw new Exception("No valid scripts found");
ParcelDescriptor desc = new ParcelDescriptor(parcelxml, language);
......
......@@ -191,8 +191,7 @@ public class JavaFinder implements MethodFinder {
private String[] findClassNames(File basedir) {
ArrayList<File> classFiles = findFiles(basedir, CLASS_SUFFIX);
if (classFiles == null || classFiles.size() == 0)
if(classFiles == null || classFiles.isEmpty())
return null;
ArrayList<File> javaFiles = findFiles(basedir, JAVA_SUFFIX);
......
......@@ -281,7 +281,7 @@ class AccTreeNode
@Override
public boolean isLeaf()
{
return (maHandlers.size() == 0);
return maHandlers.isEmpty();
}
@Override
......
......@@ -98,7 +98,7 @@ class Canvas
{
aObject = new CanvasShape (aNode);
// Update bounding box that includes all objects.
if (maObjects.size() == 0)
if (maObjects.isEmpty())
maBoundingBox = aObject.getBBox();
else
maBoundingBox = maBoundingBox.union (aObject.getBBox());
......
......@@ -153,7 +153,7 @@ public class CheckMemoryUsage /* extends ComplexTestCase */
}
}
// if no param given, set defaults.
if (v.size() == 0)
if (v.isEmpty())
{
v.add(sWriterDoc);
v.add(sCalcDoc);
......
......@@ -632,7 +632,7 @@ public class FileAccess
throws NoValidPathException
{
String[][] LocLayoutFiles = new String[2][];
if (FolderName.size() == 0)
if (FolderName.isEmpty())
{
throw new NoValidPathException(null, "Path not given.");
}
......
......@@ -141,7 +141,7 @@ public class FormDocument extends TextDocument
adjustPageStyle();
if (_baddParentForm)
{
if (oControlForms.size() == 0)
if (oControlForms.isEmpty())
{
final ControlForm aMainControlForm = new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.AS_GRID));
oControlForms.add(aMainControlForm);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment