summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-20 14:56:25 +0200
committerNoel Grandin <noel@peralex.com>2014-10-07 13:20:01 +0200
commit02ace92aba684238622610776b2c618aa04c7a02 (patch)
treebc5ad8ece4558a70d6e6e39b1a699fbc47a83c55
parentjava: remove unnecessary adding of empty strings (diff)
downloadcore-02ace92aba684238622610776b2c618aa04c7a02.tar.gz
core-02ace92aba684238622610776b2c618aa04c7a02.zip
java: optimise calls to toArray
passing in a correctly sized array requires one less allocation Change-Id: I6198d226d9b630c99c4e8b6e3d0fdf890c495b44
-rw-r--r--forms/qa/integration/forms/ListBox.java4
-rw-r--r--qadevOOo/tests/java/complex/unoapi/CheckModuleAPI.java4
-rw-r--r--scripting/java/org/openoffice/idesupport/CommandLineTools.java6
3 files changed, 5 insertions, 9 deletions
diff --git a/forms/qa/integration/forms/ListBox.java b/forms/qa/integration/forms/ListBox.java
index a6e5326344e1..96a9d72a4a42 100644
--- a/forms/qa/integration/forms/ListBox.java
+++ b/forms/qa/integration/forms/ListBox.java
@@ -229,9 +229,7 @@ public class ListBox extends TestCase
}
// create the table taking all those foreign keys
- m_database.createTable( new HsqlTableDescriptor(
- m_foreignKeyTableName,
- foreignKeyColumns.toArray( new HsqlColumnDescriptor[foreignKeyColumns.size()] ) ) );
+ m_database.createTable( new HsqlTableDescriptor( m_foreignKeyTableName, foreignKeyColumns.toArray( new HsqlColumnDescriptor[foreignKeyColumns.size()] ) ) );
// fill in some data
foreignKeyInsertSQL.append( ")" );
XPreparedStatement statement = connection.prepareStatement( foreignKeyInsertSQL.toString() );
diff --git a/qadevOOo/tests/java/complex/unoapi/CheckModuleAPI.java b/qadevOOo/tests/java/complex/unoapi/CheckModuleAPI.java
index d8d64f11fb99..84c263ec79d4 100644
--- a/qadevOOo/tests/java/complex/unoapi/CheckModuleAPI.java
+++ b/qadevOOo/tests/java/complex/unoapi/CheckModuleAPI.java
@@ -304,7 +304,7 @@ public class CheckModuleAPI extends ComplexTestCase
moduleNames.add(sModuleName);
}
}
- names = moduleNames.toArray(new String[0]);
+ names = moduleNames.toArray(new String[moduleNames.size()]);
}
catch (ParameterNotFoundException ex)
{
@@ -465,7 +465,7 @@ public class CheckModuleAPI extends ComplexTestCase
}
}
- final String[] names = moduleNames.toArray(new String[0]);
+ final String[] names = moduleNames.toArray(new String[moduleNames.size()]);
return names;
}
diff --git a/scripting/java/org/openoffice/idesupport/CommandLineTools.java b/scripting/java/org/openoffice/idesupport/CommandLineTools.java
index 8fa9269ca361..522828ec2f49 100644
--- a/scripting/java/org/openoffice/idesupport/CommandLineTools.java
+++ b/scripting/java/org/openoffice/idesupport/CommandLineTools.java
@@ -174,7 +174,7 @@ public class CommandLineTools {
private boolean verbose = false;
private String language = null;
private MethodFinder finder = null;
- private ArrayList scripts = null;
+ private ArrayList<ScriptEntry> scripts = null;
private HashMap properties = new HashMap(3);
public GenerateCommand(String basedir) {
@@ -288,9 +288,7 @@ public class CommandLineTools {
throw new Exception("No valid scripts found");
ParcelDescriptor desc = new ParcelDescriptor(parcelxml, language);
- desc.setScriptEntries((ScriptEntry[])scripts.toArray(new
- ScriptEntry[scripts.size()]));
-
+ desc.setScriptEntries(scripts.toArray(new ScriptEntry[scripts.size()]));
if (properties.size() != 0) {
Enumeration enumer = properties.keys();