This is an automated email from the ASF dual-hosted git repository.

tilman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/main by this push:
     new 876f7ede8 TIKA-4290 Replaced loop with parametrized constructor call 
(#1901)
876f7ede8 is described below

commit 876f7ede849161f4df55a9f0693c9252f57c1b80
Author: Dmitry Kryukov <d...@users.noreply.github.com>
AuthorDate: Wed Aug 14 11:10:52 2024 +0300

    TIKA-4290 Replaced loop with parametrized constructor call (#1901)
---
 tika-core/src/main/java/org/apache/tika/pipes/PipesConfigBase.java     | 3 +--
 .../onenote/fsshttpb/streamobj/RevisionManifestDataElementData.java    | 3 +--
 .../onenote/fsshttpb/streamobj/StorageManifestDataElementData.java     | 3 +--
 .../parser/microsoft/onenote/fsshttpb/streamobj/basic/CellIDArray.java | 3 +--
 .../parser/microsoft/onenote/fsshttpb/streamobj/basic/ExGUIDArray.java | 3 +--
 .../fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfContextIDs.java  | 3 +--
 .../fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfOIDs.java        | 3 +--
 .../fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfOSIDs.java       | 3 +--
 .../main/java/org/apache/tika/parser/txt/Icu4jEncodingDetector.java    | 3 +--
 9 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/tika-core/src/main/java/org/apache/tika/pipes/PipesConfigBase.java 
b/tika-core/src/main/java/org/apache/tika/pipes/PipesConfigBase.java
index 27e6a49fb..83ad11e9e 100644
--- a/tika-core/src/main/java/org/apache/tika/pipes/PipesConfigBase.java
+++ b/tika-core/src/main/java/org/apache/tika/pipes/PipesConfigBase.java
@@ -98,8 +98,7 @@ public class PipesConfigBase extends ConfigBase {
 
     public List<String> getForkedJvmArgs() {
         //defensive copy
-        List<String> ret = new ArrayList<>();
-        ret.addAll(forkedJvmArgs);
+        List<String> ret = new ArrayList<>(forkedJvmArgs);
         return ret;
     }
 
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/RevisionManifestDataElementData.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/RevisionManifestDataElementData.java
index 74695d1d5..fda9d134f 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/RevisionManifestDataElementData.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/RevisionManifestDataElementData.java
@@ -88,8 +88,7 @@ public class RevisionManifestDataElementData extends 
DataElementData {
      */
     @Override
     public List<Byte> serializeToByteList() throws TikaException, IOException {
-        List<Byte> byteList = new ArrayList<>();
-        byteList.addAll(this.revisionManifest.serializeToByteList());
+        List<Byte> byteList = new 
ArrayList<>(this.revisionManifest.serializeToByteList());
 
         if (this.revisionManifestRootDeclareList != null) {
             for (RevisionManifestRootDeclare revisionManifestRootDeclare : 
this.revisionManifestRootDeclareList) {
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/StorageManifestDataElementData.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/StorageManifestDataElementData.java
index d3162e131..72d4ffafc 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/StorageManifestDataElementData.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/StorageManifestDataElementData.java
@@ -46,8 +46,7 @@ public class StorageManifestDataElementData extends 
DataElementData {
      */
     @Override
     public List<Byte> serializeToByteList() throws TikaException, IOException {
-        List<Byte> byteList = new ArrayList<Byte>();
-        byteList.addAll(this.storageManifestSchemaGUID.serializeToByteList());
+        List<Byte> byteList = new 
ArrayList<Byte>(this.storageManifestSchemaGUID.serializeToByteList());
 
         if (this.storageManifestRootDeclareList != null) {
             for (StorageManifestRootDeclare storageManifestRootDeclare : 
this.storageManifestRootDeclareList) {
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/basic/CellIDArray.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/basic/CellIDArray.java
index 8681572bd..235d26515 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/basic/CellIDArray.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/basic/CellIDArray.java
@@ -67,8 +67,7 @@ public class CellIDArray extends BasicObject {
      */
     @Override
     public List<Byte> serializeToByteList() throws IOException {
-        List<Byte> byteList = new ArrayList<Byte>();
-        byteList.addAll((new 
Compact64bitInt(this.count)).serializeToByteList());
+        List<Byte> byteList = new ArrayList<Byte>((new 
Compact64bitInt(this.count)).serializeToByteList());
         if (this.content != null) {
             for (CellID extendGuid : this.content) {
                 byteList.addAll(extendGuid.serializeToByteList());
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/basic/ExGUIDArray.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/basic/ExGUIDArray.java
index 45e2ba9df..270c9b2d8 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/basic/ExGUIDArray.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/basic/ExGUIDArray.java
@@ -83,8 +83,7 @@ public class ExGUIDArray extends BasicObject {
     public List<Byte> serializeToByteList() throws IOException {
         this.count.setDecodedValue(this.content.size());
 
-        List<Byte> result = new ArrayList<>();
-        result.addAll(this.count.serializeToByteList());
+        List<Byte> result = new ArrayList<>(this.count.serializeToByteList());
         for (ExGuid extendGuid : this.content) {
             result.addAll(extendGuid.serializeToByteList());
         }
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfContextIDs.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfContextIDs.java
index cc5765a64..0f65dfc6c 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfContextIDs.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfContextIDs.java
@@ -36,8 +36,7 @@ public class ObjectSpaceObjectStreamOfContextIDs {
      * @return Return the byte list which store the byte information of 
ObjectSpaceObjectStreamOfContextIDs
      */
     public List<Byte> serializeToByteList() throws IOException {
-        List<Byte> byteList = new ArrayList<>();
-        byteList.addAll(this.header.serializeToByteList());
+        List<Byte> byteList = new 
ArrayList<>(this.header.serializeToByteList());
         for (CompactID compactID : this.body) {
             byteList.addAll(compactID.serializeToByteList());
         }
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfOIDs.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfOIDs.java
index 78e13401d..502f3bdaa 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfOIDs.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfOIDs.java
@@ -37,8 +37,7 @@ public class ObjectSpaceObjectStreamOfOIDs {
      * @return Return the byte list which store the byte information of 
ObjectSpaceObjectStreamOfOIDs
      */
     public List<Byte> serializeToByteList() throws IOException {
-        List<Byte> byteList = new ArrayList<>();
-        byteList.addAll(this.header.serializeToByteList());
+        List<Byte> byteList = new 
ArrayList<>(this.header.serializeToByteList());
         for (CompactID compactID : this.body) {
             byteList.addAll(compactID.serializeToByteList());
         }
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfOSIDs.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfOSIDs.java
index f6072b3d0..b6bad36df 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfOSIDs.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/space/ObjectSpaceObjectStreamOfOSIDs.java
@@ -36,8 +36,7 @@ public class ObjectSpaceObjectStreamOfOSIDs {
      * @return Return the byte list which store the byte information of 
ObjectSpaceObjectStreamOfOSIDs
      */
     public List<Byte> serializeToByteList() throws IOException {
-        List<Byte> byteList = new ArrayList<>();
-        byteList.addAll(this.header.serializeToByteList());
+        List<Byte> byteList = new 
ArrayList<>(this.header.serializeToByteList());
         for (CompactID compactID : this.body) {
             byteList.addAll(compactID.serializeToByteList());
         }
diff --git 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/txt/Icu4jEncodingDetector.java
 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/txt/Icu4jEncodingDetector.java
index 15189988e..2677a4d34 100644
--- 
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/txt/Icu4jEncodingDetector.java
+++ 
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-text-module/src/main/java/org/apache/tika/parser/txt/Icu4jEncodingDetector.java
@@ -133,8 +133,7 @@ public class Icu4jEncodingDetector implements 
EncodingDetector {
     }
 
     public List<String> getIgnoreCharsets() {
-        List<String> ret = new ArrayList<>();
-        ret.addAll(ignoreCharsets);
+        List<String> ret = new ArrayList<>(ignoreCharsets);
         Collections.sort(ret);
         return ret;
     }

Reply via email to