From dd692aac64b038e7f416f014ba5b01c0872461b3 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 13 Jul 2015 10:26:01 +0000
Subject: [PATCH] Used CollectionUtils methods.

---
 opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationDomainTest.java                   |    6 
 opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java                         |    7 
 opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java                                        |   18 +--
 opendj-server-legacy/src/main/java/org/opends/server/core/SubentryManager.java                                        |    7 -
 opendj-server-legacy/src/test/java/org/opends/server/loggers/AbstractTextAccessLogPublisherTest.java                  |   37 ++-----
 opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java                                |   25 +---
 opendj-server-legacy/src/test/java/org/opends/server/tasks/TestBackupAndRestore.java                                  |    9 +
 opendj-server-legacy/src/main/java/org/opends/quicksetup/Installation.java                                            |    5 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/EntryCachesMonitoringPanel.java                |    6 
 opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java                                   |    3 
 opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java                   |    6 
 opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java                                        |   10 -
 opendj-server-legacy/src/main/java/org/opends/server/extensions/ExactMatchIdentityMapper.java                         |    5 
 opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java                                  |   12 +-
 opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/SequentialDBCursor.java        |    5 
 opendj-server-legacy/src/main/java/org/opends/server/extensions/RegularExpressionIdentityMapper.java                  |    5 
 opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapper.java        |    7 
 opendj-server-legacy/src/main/java/org/opends/server/extensions/WhoAmIExtendedOperation.java                          |   20 +--
 opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/je/JEReplicaDBTest.java             |    5 
 opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java                  |    2 
 opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java                                    |   11 -
 opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java                                   |    4 
 opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java                                        |    6 
 opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/FileReplicaDBTest.java         |    4 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java                       |   13 +-
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java                              |    7 
 opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java             |   11 -
 opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java                           |    5 
 opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java                    |    2 
 opendj-server-legacy/src/main/java/org/opends/server/extensions/FingerprintCertificateMapper.java                     |   10 +
 opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java |    5 
 31 files changed, 110 insertions(+), 168 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/EntryCachesMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/EntryCachesMonitoringPanel.java
index 5cb8b6c..4c5d7ab 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/EntryCachesMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/EntryCachesMonitoringPanel.java
@@ -29,7 +29,6 @@
 import java.awt.Component;
 import java.awt.GridBagConstraints;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 import javax.swing.Box;
@@ -39,6 +38,7 @@
 import org.opends.guitools.controlpanel.datamodel.MonitoringAttributes;
 import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
 import org.opends.guitools.controlpanel.util.Utilities;
+import org.opends.server.util.CollectionUtils;
 
 import static org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes.*;
 import static org.opends.guitools.controlpanel.util.Utilities.*;
@@ -49,9 +49,9 @@
 public class EntryCachesMonitoringPanel extends GeneralMonitoringPanel
 {
   private static final long serialVersionUID = 9031734563700069830L;
-  private static List<MonitoringAttributes> ngOperations = new ArrayList<MonitoringAttributes>(Arrays.asList(
+  private static List<MonitoringAttributes> ngOperations = CollectionUtils.<MonitoringAttributes> newArrayList(
       ENTRY_CACHE_TRIES, ENTRY_CACHE_HITS, ENTRY_CACHE_HIT_RATIO, CURRENT_ENTRY_CACHE_SIZE, MAX_ENTRY_CACHE_SIZE,
-      CURRENT_ENTRY_CACHE_COUNT, MAX_ENTRY_CACHE_COUNT));
+      CURRENT_ENTRY_CACHE_COUNT, MAX_ENTRY_CACHE_COUNT);
 
   private ArrayList<JLabel> monitoringLabels = new ArrayList<>();
   {
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
index ea1af28..c896ce2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
@@ -27,6 +27,8 @@
 package org.opends.guitools.controlpanel.ui;
 
 import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
+
 import static com.forgerock.opendj.util.OperatingSystem.isWindows;
 
 import java.awt.Component;
@@ -41,7 +43,6 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.HashSet;
@@ -85,7 +86,6 @@
 /**
  * The panel where the user can specify the java arguments and java home to be
  * used in the command-lines.
- *
  */
 public class JavaPropertiesPanel extends StatusGenericPanel
 {
@@ -111,7 +111,7 @@
 
   private Set<JavaArgumentsDescriptor> readJavaArguments = new HashSet<>();
   private Set<JavaArgumentsDescriptor> currentJavaArguments = new HashSet<>();
-  private Set<String> allScriptNames = new HashSet<>(Arrays.asList(
+  private Set<String> allScriptNames = newHashSet(
         "start-ds", "import-ldif.offline", "backup.online", "base64",
         "create-rc-script", "dsconfig", "dsreplication",
         "export-ldif.online", "import-ldif.online", "ldapcompare",
@@ -122,14 +122,13 @@
         "ldif-diff", "ldifmodify", "ldifsearch", "make-ldif",
         "rebuild-index", "restore.offline", "upgrade",
         "verify-index", "dbtest"
-      ));
-
-  private Set<String> relevantScriptNames = new HashSet<>(Arrays.asList(
+      );
+  private Set<String> relevantScriptNames = newHashSet(
         "start-ds", "import-ldif.offline", "backup.offline",
         "export-ldif.offline",
         "ldif-diff", "make-ldif", "rebuild-index", "restore.offline",
         "verify-index", "dbtest"
-      ));
+      );
 
   private String readJavaHome;
   private boolean readUseOpenDSJavaHome;
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Installation.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Installation.java
index 2714396..9a15f20 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Installation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Installation.java
@@ -34,8 +34,6 @@
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
@@ -44,6 +42,7 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.quicksetup.util.Utils;
+import org.opends.server.util.CollectionUtils;
 import org.opends.server.util.SetupUtils;
 
 /**
@@ -198,7 +197,7 @@
       String[] children = rootDirectory.list();
       if (children != null)
       {
-        Set<String> childrenSet = new HashSet<>(Arrays.asList(children));
+        Set<String> childrenSet = CollectionUtils.newHashSet(children);
         for (String dir : REQUIRED_DIRECTORIES)
         {
           if (!childrenSet.contains(dir))
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java
index ccd26be..feb818d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java
@@ -30,7 +30,6 @@
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -65,6 +64,7 @@
 import org.opends.server.types.LDIFImportResult;
 import org.opends.server.types.ObjectClass;
 import org.opends.server.types.RestoreConfig;
+import org.opends.server.util.CollectionUtils;
 import org.opends.server.util.LDIFException;
 import org.opends.server.util.LDIFReader;
 import org.opends.server.util.LDIFWriter;
@@ -110,12 +110,12 @@
   private HashSet<DN> baseDNSet;
 
   /** The set of supported controls for this backend. */
-  private final Set<String> supportedControls = new HashSet<>(Arrays.asList(
+  private final Set<String> supportedControls = CollectionUtils.newHashSet(
       OID_SUBTREE_DELETE_CONTROL,
       OID_PAGED_RESULTS_CONTROL,
       OID_MANAGE_DSAIT_CONTROL,
       OID_SERVER_SIDE_SORT_REQUEST_CONTROL,
-      OID_VLV_REQUEST_CONTROL));
+      OID_VLV_REQUEST_CONTROL);
 
   /** The map of null entry object classes. */
   private Map<ObjectClass,String> objectClasses;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java
index b9f18ad..b244f5b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java
@@ -41,9 +41,7 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.ListIterator;
@@ -99,6 +97,7 @@
 import org.opends.server.types.Privilege;
 import org.opends.server.types.RestoreConfig;
 import org.opends.server.util.BackupManager;
+import org.opends.server.util.CollectionUtils;
 import org.opends.server.util.RuntimeInformation;
 
 import com.sleepycat.je.DatabaseException;
@@ -131,15 +130,13 @@
   private DiskSpaceMonitor diskMonitor;
   private StorageStatus storageStatus = StorageStatus.working();
 
-  /**
-   * The controls supported by this backend.
-   */
-  private static final Set<String> supportedControls = new HashSet<>(Arrays.asList(
+  /** The controls supported by this backend. */
+  private static final Set<String> supportedControls = CollectionUtils.newHashSet(
       OID_SUBTREE_DELETE_CONTROL,
       OID_PAGED_RESULTS_CONTROL,
       OID_MANAGE_DSAIT_CONTROL,
       OID_SERVER_SIDE_SORT_REQUEST_CONTROL,
-      OID_VLV_REQUEST_CONTROL));
+      OID_VLV_REQUEST_CONTROL);
 
   /** Begin a Backend API method that reads the database. */
   private void readerBegin()
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java
index 7b1defd..0fced90 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java
@@ -33,9 +33,7 @@
 import static org.opends.server.util.StaticUtils.*;
 
 import java.io.IOException;
-import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.SortedSet;
@@ -84,6 +82,7 @@
 import org.opends.server.types.OpenDsException;
 import org.opends.server.types.Operation;
 import org.opends.server.types.RestoreConfig;
+import org.opends.server.util.CollectionUtils;
 import org.opends.server.util.LDIFException;
 import org.opends.server.util.RuntimeInformation;
 
@@ -116,12 +115,12 @@
   private Storage storage;
 
   /** The controls supported by this backend. */
-  private static final Set<String> supportedControls = new HashSet<>(Arrays.asList(
+  private static final Set<String> supportedControls = CollectionUtils.newHashSet(
       OID_SUBTREE_DELETE_CONTROL,
       OID_PAGED_RESULTS_CONTROL,
       OID_MANAGE_DSAIT_CONTROL,
       OID_SERVER_SIDE_SORT_REQUEST_CONTROL,
-      OID_VLV_REQUEST_CONTROL));
+      OID_VLV_REQUEST_CONTROL);
 
   /**
    * Begin a Backend API method that accesses the {@link EntryContainer} for <code>entryDN</code>
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java b/opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java
index b82d459..868af03 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java
@@ -29,9 +29,9 @@
 import static org.forgerock.opendj.ldap.ResultCode.*;
 import static org.opends.messages.ConfigMessages.*;
 import static org.opends.server.core.DirectoryServer.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.StaticUtils.*;
 
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -306,7 +306,7 @@
     Backend<?> backend = registeredBackends.get(backendDN);
     if (backend != null)
     {
-      LinkedHashSet<DN> removedDNs = new LinkedHashSet<>(Arrays.asList(backend.getBaseDNs()));
+      LinkedHashSet<DN> removedDNs = newLinkedHashSet(backend.getBaseDNs());
       LinkedHashSet<DN> addedDNs = new LinkedHashSet<>(baseDNs);
       Iterator<DN> iterator = removedDNs.iterator();
       while (iterator.hasNext())
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
index bdc51a3..3c9fb8d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -44,7 +44,6 @@
 import java.lang.management.ManagementFactory;
 import java.net.InetAddress;
 import java.text.DecimalFormat;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
@@ -753,7 +752,7 @@
   private TreeMap<String, Backend<?>> backends;
 
   /** The set of supported controls registered with the Directory Server. */
-  private final TreeSet<String> supportedControls = new TreeSet<>(Arrays.asList(
+  private final TreeSet<String> supportedControls = newTreeSet(
       OID_LDAP_ASSERTION,
       OID_LDAP_READENTRY_PREREAD,
       OID_LDAP_READENTRY_POSTREAD,
@@ -771,23 +770,18 @@
       OID_VIRTUAL_ATTRS_ONLY,
       OID_ACCOUNT_USABLE_CONTROL,
       OID_NS_PASSWORD_EXPIRED,
-      OID_NS_PASSWORD_EXPIRING));
+      OID_NS_PASSWORD_EXPIRING);
 
   /** The set of supported feature OIDs registered with the Directory Server. */
-  private final TreeSet<String> supportedFeatures = new TreeSet<>(Arrays.asList(
+  private final TreeSet<String> supportedFeatures = newTreeSet(
       OID_ALL_OPERATIONAL_ATTRS_FEATURE,
       OID_MODIFY_INCREMENT_FEATURE,
-      OID_TRUE_FALSE_FILTERS_FEATURE));
+      OID_TRUE_FALSE_FILTERS_FEATURE);
 
-  /**
-   * The trust manager provider configuration manager for the Directory Server.
-   */
+  /** The trust manager provider configuration manager for the Directory Server. */
   private TrustManagerProviderConfigManager trustManagerProviderConfigManager;
 
-  /**
-   * The virtual attribute provider configuration manager for the Directory
-   * Server.
-   */
+  /** The virtual attribute provider configuration manager for the Directory Server. */
   private final VirtualAttributeConfigManager virtualAttributeConfigManager;
 
   /** The work queue that will be used to service client requests. */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryManager.java b/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryManager.java
index 2d865e8..fd3a409 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryManager.java
@@ -67,6 +67,7 @@
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
 import static org.opends.server.protocols.internal.Requests.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 
 /**
@@ -134,12 +135,8 @@
     dn2SubEntry = new HashMap<>();
     dn2CollectiveSubEntry = new HashMap<>();
     dit2SubEntry = new DITCacheMap<>();
-
     changeListeners = new CopyOnWriteArrayList<>();
-
-    requestAttrs = new LinkedHashSet<>();
-    requestAttrs.add("*");
-    requestAttrs.add("+");
+    requestAttrs = newLinkedHashSet("*", "+");
 
     DirectoryServer.registerInternalPlugin(this);
     DirectoryServer.registerBackendInitializationListener(this);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/ExactMatchIdentityMapper.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/ExactMatchIdentityMapper.java
index 48f5970..3246ad4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/ExactMatchIdentityMapper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/ExactMatchIdentityMapper.java
@@ -54,6 +54,7 @@
 
 import static org.opends.messages.ExtensionMessages.*;
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 /**
  * This class provides an implementation of a Directory Server identity mapper
@@ -136,9 +137,7 @@
 
     // Create the attribute list to include in search requests.  We want to
     // include all user and operational attributes.
-    requestedAttributes = new LinkedHashSet<>(2);
-    requestedAttributes.add("*");
-    requestedAttributes.add("+");
+    requestedAttributes = newLinkedHashSet("*", "+");
   }
 
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/FingerprintCertificateMapper.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/FingerprintCertificateMapper.java
index fdd32e1..5243919 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/FingerprintCertificateMapper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/FingerprintCertificateMapper.java
@@ -29,7 +29,10 @@
 import java.security.MessageDigest;
 import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
-import java.util.*;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
 
 import javax.security.auth.x500.X500Principal;
 
@@ -54,6 +57,7 @@
 
 import static org.opends.messages.ExtensionMessages.*;
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.StaticUtils.*;
 
 /**
@@ -141,9 +145,7 @@
 
     // Create the attribute list to include in search requests.  We want to
     // include all user and operational attributes.
-    requestedAttributes = new LinkedHashSet<>(2);
-    requestedAttributes.add("*");
-    requestedAttributes.add("+");
+    requestedAttributes = newLinkedHashSet("*", "+");
   }
 
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java
index f9e4ffe..a57153e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java
@@ -118,7 +118,7 @@
    */
   public PasswordModifyExtendedOperation()
   {
-    super(new HashSet<String>(Arrays.asList(OID_LDAP_NOOP_OPENLDAP_ASSIGNED, OID_PASSWORD_POLICY_CONTROL)));
+    super(newHashSet(OID_LDAP_NOOP_OPENLDAP_ASSIGNED, OID_PASSWORD_POLICY_CONTROL));
   }
 
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java
index bc22404..892eec2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java
@@ -51,14 +51,12 @@
 import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.protocols.internal.InternalSearchOperation;
 import org.opends.server.protocols.internal.SearchRequest;
-
-import static org.opends.server.protocols.internal.Requests.*;
-
 import org.opends.server.schema.GeneralizedTimeSyntax;
 import org.opends.server.types.*;
 
 import static org.opends.messages.CoreMessages.*;
 import static org.opends.messages.ExtensionMessages.*;
+import static org.opends.server.protocols.internal.Requests.*;
 import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -287,12 +285,7 @@
          throws ConfigException, InitializationException
   {
     userFilter = SearchFilter.objectClassPresent();
-
-    // Construct the set of request attributes.
-    requestAttributes = new LinkedHashSet<>(2);
-    requestAttributes.add("*");
-    requestAttributes.add("+");
-
+    requestAttributes = newLinkedHashSet("*", "+");
 
     DirectoryServer.registerSupportedExtension(OID_PASSWORD_POLICY_STATE_EXTOP, this);
     // FIXME registerControlAndFeatures?
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/RegularExpressionIdentityMapper.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/RegularExpressionIdentityMapper.java
index 835b8b3..adf65e1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/RegularExpressionIdentityMapper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/RegularExpressionIdentityMapper.java
@@ -29,6 +29,7 @@
 import static org.opends.messages.ExtensionMessages.*;
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
 import static org.opends.server.protocols.internal.Requests.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -163,9 +164,7 @@
 
     // Create the attribute list to include in search requests.  We want to
     // include all user and operational attributes.
-    requestedAttributes = new LinkedHashSet<>(2);
-    requestedAttributes.add("*");
-    requestedAttributes.add("+");
+    requestedAttributes = newLinkedHashSet("*", "+");
   }
 
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java
index ac5f788..f9b60b2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java
@@ -30,6 +30,7 @@
 import static org.opends.messages.ExtensionMessages.*;
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
 import static org.opends.server.protocols.internal.Requests.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.StaticUtils.*;
 
 import java.security.cert.Certificate;
@@ -144,9 +145,7 @@
 
     // Create the attribute list to include in search requests. We want to
     // include all user and operational attributes.
-    requestedAttributes = new LinkedHashSet<>(2);
-    requestedAttributes.add("*");
-    requestedAttributes.add("+");
+    requestedAttributes = newLinkedHashSet("*", "+");
   }
 
   /** {@inheritDoc} */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapper.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapper.java
index bab9149..2cd71f3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapper.java
@@ -51,11 +51,12 @@
 import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.protocols.internal.InternalSearchOperation;
 import org.opends.server.protocols.internal.SearchRequest;
-import static org.opends.server.protocols.internal.Requests.*;
 import org.opends.server.types.*;
 
 import static org.opends.messages.ExtensionMessages.*;
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.protocols.internal.Requests.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 /**
  * This class implements a very simple Directory Server certificate mapper that
@@ -127,9 +128,7 @@
 
     // Create the attribute list to include in search requests.  We want to
     // include all user and operational attributes.
-    requestedAttributes = new LinkedHashSet<>(2);
-    requestedAttributes.add("*");
-    requestedAttributes.add("+");
+    requestedAttributes = newLinkedHashSet("*", "+");
   }
 
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/WhoAmIExtendedOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/WhoAmIExtendedOperation.java
index f6d42b1..5819333 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/WhoAmIExtendedOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/WhoAmIExtendedOperation.java
@@ -26,24 +26,23 @@
  */
 package org.opends.server.extensions;
 
-import java.util.Arrays;
-import java.util.HashSet;
+import static org.opends.messages.ExtensionMessages.*;
+import static org.opends.messages.ProtocolMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
+import static org.opends.server.util.ServerConstants.*;
 
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.opends.server.admin.std.server.WhoAmIExtendedOperationHandlerCfg;
 import org.opends.server.api.ClientConnection;
 import org.opends.server.api.ExtendedOperationHandler;
-import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.controls.ProxiedAuthV1Control;
 import org.opends.server.controls.ProxiedAuthV2Control;
 import org.opends.server.core.AccessControlConfigManager;
 import org.opends.server.core.ExtendedOperation;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.types.*;
-import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.ldap.ByteString;
-import static org.opends.messages.ExtensionMessages.*;
-import static org.opends.messages.ProtocolMessages.ERR_PROXYAUTH_AUTHZ_NOT_PERMITTED;
-import static org.opends.server.util.ServerConstants.*;
 
 /**
  * This class implements the "Who Am I?" extended operation defined in RFC 4532.
@@ -61,8 +60,7 @@
    */
   public WhoAmIExtendedOperation()
   {
-    super(new HashSet<String>(Arrays.asList(
-        OID_PROXIED_AUTH_V1, OID_PROXIED_AUTH_V2)));
+    super(newHashSet(OID_PROXIED_AUTH_V1, OID_PROXIED_AUTH_V2));
   }
 
   /** {@inheritDoc} */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 203e218..33e00aa 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -117,7 +117,7 @@
    * replication related operational attributes when used in a search operation.
    */
   private static final Set<String> USER_AND_REPL_OPERATIONAL_ATTRS =
-      new HashSet<>(Arrays.asList(HISTORICAL_ATTRIBUTE_NAME, ENTRYUUID_ATTRIBUTE_NAME, "*"));
+      newHashSet(HISTORICAL_ATTRIBUTE_NAME, ENTRYUUID_ATTRIBUTE_NAME, "*");
 
   /**
    * This class is used in the session establishment phase
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java
index 2173ec2..77f7f7d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java
@@ -26,11 +26,9 @@
  */
 package org.opends.server.schema;
 
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -38,6 +36,7 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.config.server.ConfigChangeResult;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.forgerock.opendj.ldap.schema.CoreSchema;
 import org.forgerock.opendj.ldap.schema.MatchingRule;
@@ -46,9 +45,9 @@
 import org.opends.server.admin.std.server.CollationMatchingRuleCfg;
 import org.opends.server.api.MatchingRuleFactory;
 import org.opends.server.core.DirectoryServer;
-import org.forgerock.opendj.config.server.ConfigChangeResult;
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.InitializationException;
+import org.opends.server.util.CollectionUtils;
 
 import static org.opends.messages.ConfigMessages.*;
 import static org.opends.messages.SchemaMessages.*;
@@ -64,7 +63,7 @@
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
   /** Stores the list of available locales on this JVM. */
-  private static final Set<Locale> supportedLocales = new HashSet<>(Arrays.asList(Locale.getAvailableLocales()));
+  private static final Set<Locale> supportedLocales = CollectionUtils.newHashSet(Locale.getAvailableLocales());
 
   /** Current Configuration. */
   private CollationMatchingRuleCfg currentConfig;
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java
index 822938f..69a0607 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java
@@ -29,6 +29,7 @@
 
 import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.testng.Assert.*;
 
@@ -842,7 +843,7 @@
   public Object[][] invalidAcis() throws Exception {
     TestCaseUtils.startServer();  // This appears to be necessary since the DataProviders can be called before @BeforeClass.
 
-    List<String> invalid = new ArrayList<>(Arrays.asList(INVALID_ACIS));
+    List<String> invalid = newArrayList(INVALID_ACIS);
     for (String[] aciAndMask: INVALID_ACIS_IF_ANY_CHAR_REMOVED) {
       invalid.addAll(getAciMissingCharCombos(aciAndMask[0], aciAndMask[1]));
     }
@@ -2595,7 +2596,7 @@
   }
 
   private static String getNotThisDayOfWeek() {
-    Set<String> otherDays = new HashSet<>(Arrays.asList(DAYS_OF_WEEK));
+    Set<String> otherDays = newHashSet(DAYS_OF_WEEK);
     otherDays.remove(getThisDayOfWeek());
     String dayList = "";
     for (String otherDay: otherDays) {
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
index a5ccb6a..3713783 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
@@ -29,7 +29,6 @@
 import java.io.IOException;
 import java.net.Socket;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -202,7 +201,7 @@
 
   private ArrayList<RawAttribute> newRawAttributes(RawAttribute... attributes)
   {
-    return new ArrayList<>(Arrays.asList(attributes));
+    return newArrayList(attributes);
   }
 
   private ArrayList<ByteString> byteStrings(final String... v)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java
index eebbca9..d19a025 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java
@@ -429,8 +429,7 @@
   @Test
   public void testSearchExternalAllUserAttributes() throws Exception
   {
-    LinkedHashSet<String> attributes = new LinkedHashSet<>();
-    attributes.add("*");
+    LinkedHashSet<String> attributes = newLinkedHashSet("*");
     SearchRequestProtocolOp searchRequest =
          new SearchRequestProtocolOp(
               ByteString.valueOf(BASE),
@@ -473,8 +472,7 @@
   @Test
   public void testSearchExternalAllUserAttributesOmitValues() throws Exception
   {
-    LinkedHashSet<String> attributes = new LinkedHashSet<>();
-    attributes.add("*");
+    LinkedHashSet<String> attributes = newLinkedHashSet("*");
     SearchRequestProtocolOp searchRequest =
          new SearchRequestProtocolOp(
               ByteString.valueOf(BASE),
@@ -498,8 +496,7 @@
   @Test
   public void testSearchExternalObjectClassAttribute() throws Exception
   {
-    LinkedHashSet<String> attributes = new LinkedHashSet<>();
-    attributes.add("objectclass");
+    LinkedHashSet<String> attributes = newLinkedHashSet("objectclass");
     SearchRequestProtocolOp searchRequest =
          new SearchRequestProtocolOp(
               ByteString.valueOf(BASE),
@@ -523,8 +520,7 @@
   public void testSearchExternalObjectClassAttributeOmitValues()
        throws Exception
   {
-    LinkedHashSet<String> attributes = new LinkedHashSet<>();
-    attributes.add("objectclass");
+    LinkedHashSet<String> attributes = newLinkedHashSet("objectclass");
     SearchRequestProtocolOp searchRequest =
          new SearchRequestProtocolOp(
               ByteString.valueOf(BASE),
@@ -547,9 +543,7 @@
   @Test
   public void testSearchExternalSelectedAttributes() throws Exception
   {
-    LinkedHashSet<String> attributes = new LinkedHashSet<>();
-    attributes.add("uid");
-    attributes.add("createtimestamp");
+    LinkedHashSet<String> attributes = newLinkedHashSet("uid", "createtimestamp");
     SearchRequestProtocolOp searchRequest =
          new SearchRequestProtocolOp(
               ByteString.valueOf(BASE),
@@ -570,8 +564,7 @@
   @Test
   public void testSearchExternalAttributeWithSubtypes() throws Exception
   {
-    LinkedHashSet<String> attributes = new LinkedHashSet<>();
-    attributes.add("title");
+    LinkedHashSet<String> attributes = newLinkedHashSet("title");
     SearchRequestProtocolOp searchRequest =
          new SearchRequestProtocolOp(
               ByteString.valueOf(BASE),
@@ -593,8 +586,7 @@
   public void testSearchExternalAttributeWithSubtypesOmitValues()
        throws Exception
   {
-    LinkedHashSet<String> attributes = new LinkedHashSet<>();
-    attributes.add("title");
+    LinkedHashSet<String> attributes = newLinkedHashSet("title");
     SearchRequestProtocolOp searchRequest =
          new SearchRequestProtocolOp(
               ByteString.valueOf(BASE),
@@ -619,8 +611,7 @@
   @Test
   public void testSearchExternalAttributeWithOptions() throws Exception
   {
-    LinkedHashSet<String> attributes = new LinkedHashSet<>();
-    attributes.add("title;lang-ja;phonetic");
+    LinkedHashSet<String> attributes = newLinkedHashSet("title;lang-ja;phonetic");
     SearchRequestProtocolOp searchRequest =
          new SearchRequestProtocolOp(
               ByteString.valueOf(BASE),
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/loggers/AbstractTextAccessLogPublisherTest.java b/opendj-server-legacy/src/test/java/org/opends/server/loggers/AbstractTextAccessLogPublisherTest.java
index e1858ac..7b28f15 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/loggers/AbstractTextAccessLogPublisherTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/loggers/AbstractTextAccessLogPublisherTest.java
@@ -25,14 +25,10 @@
  */
 package org.opends.server.loggers;
 
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+import static org.opends.server.util.CollectionUtils.*;
 
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.Arrays;
-import java.util.SortedSet;
 import java.util.TreeSet;
 
 import org.forgerock.opendj.ldap.AddressMask;
@@ -56,8 +52,6 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 @SuppressWarnings("javadoc")
 public class AbstractTextAccessLogPublisherTest extends DirectoryServerTestCase
 {
@@ -188,7 +182,7 @@
   public void testCriteriaFilterRequestTargetDNEqualTo() throws Exception
   {
     final AccessLogFilteringCriteriaCfg cfg = mockCriteriaFilterCfg();
-    when(cfg.getRequestTargetDNEqualTo()).thenReturn(setOf("dc=com"));
+    when(cfg.getRequestTargetDNEqualTo()).thenReturn(newTreeSet("dc=com"));
     final CriteriaFilter filter = new CriteriaFilter(cfg);
     final SearchOperation operation = mockAnonymousSearchOperation();
     when(operation.getBaseDN()).thenReturn(dn("dc=com"), dn("dc=org"));
@@ -202,7 +196,7 @@
   public void testCriteriaFilterRequestTargetDNNotEqualTo() throws Exception
   {
     final AccessLogFilteringCriteriaCfg cfg = mockCriteriaFilterCfg();
-    when(cfg.getRequestTargetDNNotEqualTo()).thenReturn(setOf("dc=com"));
+    when(cfg.getRequestTargetDNNotEqualTo()).thenReturn(newTreeSet("dc=com"));
     final CriteriaFilter filter = new CriteriaFilter(cfg);
     final SearchOperation operation = mockAnonymousSearchOperation();
     when(operation.getBaseDN()).thenReturn(dn("dc=com"), dn("dc=org"));
@@ -244,7 +238,7 @@
   public void testCriteriaFilterResponseResultCodeEqualTo() throws Exception
   {
     final AccessLogFilteringCriteriaCfg cfg = mockCriteriaFilterCfg();
-    when(cfg.getResponseResultCodeEqualTo()).thenReturn(setOf(32));
+    when(cfg.getResponseResultCodeEqualTo()).thenReturn(newTreeSet(32));
     final CriteriaFilter filter = new CriteriaFilter(cfg);
     final SearchOperation operation = mockAnonymousSearchOperation();
     when(operation.getResultCode()).thenReturn(ResultCode.NO_SUCH_OBJECT,
@@ -259,7 +253,7 @@
   public void testCriteriaFilterResponseResultCodeNotEqualTo() throws Exception
   {
     final AccessLogFilteringCriteriaCfg cfg = mockCriteriaFilterCfg();
-    when(cfg.getResponseResultCodeNotEqualTo()).thenReturn(setOf(32));
+    when(cfg.getResponseResultCodeNotEqualTo()).thenReturn(newTreeSet(32));
     final CriteriaFilter filter = new CriteriaFilter(cfg);
     final SearchOperation operation = mockAnonymousSearchOperation();
     when(operation.getResultCode()).thenReturn(ResultCode.NO_SUCH_OBJECT,
@@ -275,7 +269,7 @@
   {
     final AccessLogFilteringCriteriaCfg cfg = mockCriteriaFilterCfg();
     when(cfg.getUserDNEqualTo())
-        .thenReturn(setOf(dnOfUserInGroup().toString()));
+        .thenReturn(newTreeSet(dnOfUserInGroup().toString()));
     final CriteriaFilter filter = new CriteriaFilter(cfg);
     final SearchOperation operation1 = mockAuthenticatedSearchOperation(dnOfUserInGroup());
     assertThat(filter.isRequestLoggable(operation1)).isTrue();
@@ -290,7 +284,7 @@
   {
     final AccessLogFilteringCriteriaCfg cfg = mockCriteriaFilterCfg();
     when(cfg.getUserDNNotEqualTo()).thenReturn(
-        setOf(dnOfUserInGroup().toString()));
+        newTreeSet(dnOfUserInGroup().toString()));
     final CriteriaFilter filter = new CriteriaFilter(cfg);
     final SearchOperation operation1 = mockAuthenticatedSearchOperation(dnOfUserInGroup());
     assertThat(filter.isRequestLoggable(operation1)).isFalse();
@@ -304,7 +298,7 @@
   public void testCriteriaFilterUserIsMemberOf() throws Exception
   {
     final AccessLogFilteringCriteriaCfg cfg = mockCriteriaFilterCfg();
-    when(cfg.getUserIsMemberOf()).thenReturn(setOf(dnOfGroup()));
+    when(cfg.getUserIsMemberOf()).thenReturn(newTreeSet(dnOfGroup()));
     final CriteriaFilter filter = new CriteriaFilter(cfg);
     final SearchOperation operation1 = mockAuthenticatedSearchOperation(dnOfUserInGroup());
     assertThat(filter.isRequestLoggable(operation1)).isTrue();
@@ -318,7 +312,7 @@
   public void testCriteriaFilterUserIsNotMemberOf() throws Exception
   {
     final AccessLogFilteringCriteriaCfg cfg = mockCriteriaFilterCfg();
-    when(cfg.getUserIsNotMemberOf()).thenReturn(setOf(dnOfGroup()));
+    when(cfg.getUserIsNotMemberOf()).thenReturn(newTreeSet(dnOfGroup()));
     final CriteriaFilter filter = new CriteriaFilter(cfg);
     final SearchOperation operation1 = mockAuthenticatedSearchOperation(dnOfUserInGroup());
     assertThat(filter.isRequestLoggable(operation1)).isFalse();
@@ -406,8 +400,6 @@
     return cfg;
   }
 
-
-
   private SearchOperation mockSearchOperation(final AuthenticationInfo authInfo)
       throws Exception
   {
@@ -419,11 +411,4 @@
     when(connection.getAuthenticationInfo()).thenReturn(authInfo);
     return operation;
   }
-
-
-
-  private <T> SortedSet<T> setOf(final T... values)
-  {
-    return new TreeSet<>(Arrays.asList(values));
-  }
 }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/FileReplicaDBTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/FileReplicaDBTest.java
index 45a0ad6..8d72446 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/FileReplicaDBTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/FileReplicaDBTest.java
@@ -28,7 +28,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 
 import org.assertj.core.api.SoftAssertions;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -57,6 +56,7 @@
 import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.replication.server.changelog.api.DBCursor.KeyMatchingStrategy.*;
 import static org.opends.server.replication.server.changelog.api.DBCursor.PositionStrategy.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
@@ -180,7 +180,7 @@
       replicaDB = newReplicaDB(replicationServer);
 
       final CSN[] csns = generateCSNs(1, System.currentTimeMillis(), 5);
-      final ArrayList<CSN> csns2 = new ArrayList<>(Arrays.asList(csns));
+      final ArrayList<CSN> csns2 = newArrayList(csns);
       csns2.remove(csns[3]);
 
       for (CSN csn : csns2)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/SequentialDBCursor.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/SequentialDBCursor.java
index 76bd2c9..6c65244 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/SequentialDBCursor.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/SequentialDBCursor.java
@@ -25,12 +25,11 @@
  */
 package org.opends.server.replication.server.changelog.file;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 import org.opends.server.replication.protocol.UpdateMsg;
 import org.opends.server.replication.server.changelog.api.DBCursor;
+import org.opends.server.util.CollectionUtils;
 
 @SuppressWarnings("javadoc")
 class SequentialDBCursor implements DBCursor<UpdateMsg>
@@ -48,7 +47,7 @@
    */
   public SequentialDBCursor(UpdateMsg... msgs)
   {
-    this.msgs = new ArrayList<>(Arrays.asList(msgs));
+    this.msgs = CollectionUtils.newArrayList(msgs);
   }
 
   public void add(UpdateMsg msg)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/je/JEReplicaDBTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/je/JEReplicaDBTest.java
index 61d6d5a..b2ea0c4 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/je/JEReplicaDBTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/je/JEReplicaDBTest.java
@@ -28,8 +28,6 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 import org.assertj.core.api.SoftAssertions;
@@ -50,6 +48,7 @@
 import org.opends.server.replication.server.changelog.api.DBCursor.KeyMatchingStrategy;
 import org.opends.server.replication.server.changelog.api.DBCursor.PositionStrategy;
 import org.opends.server.types.DN;
+import org.opends.server.util.CollectionUtils;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
@@ -115,7 +114,7 @@
     // but use only 4 of them for update msg
     // beforeCsn, middleCsn and afterCsn are not used
     // in order to test cursor generation from a key not present in the log (before, in the middle, after)
-    final List<CSN> usedCsns = new ArrayList<>(Arrays.asList(sevenCsns));
+    final List<CSN> usedCsns = CollectionUtils.newArrayList(sevenCsns);
     usedCsns.remove(beforeCsn);
     usedCsns.remove(middleCsn);
     usedCsns.remove(afterCsn);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java
index 23806be..65126c4 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java
@@ -50,6 +50,7 @@
 import static org.opends.messages.ReplicationMessages.*;
 import static org.opends.server.TestCaseUtils.*;
 import static org.opends.server.replication.service.ReplicationBroker.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
@@ -255,10 +256,9 @@
         entry(12, NOTE_RS_HAS_DIFFERENT_GROUP_ID_THAN_DS.ordinal()));
   }
 
-  private void containsOnly(final Map<Integer, LocalizableMessage> evaluations,
-      MapEntry... entries)
+  private void containsOnly(final Map<Integer, LocalizableMessage> evaluations, MapEntry... entries)
   {
-    final List<MapEntry> notFound = new ArrayList<>(Arrays.asList(entries));
+    final List<MapEntry> notFound = newArrayList(entries);
     for (Iterator<MapEntry> iter = notFound.iterator(); iter.hasNext();)
     {
       final MapEntry entry = iter.next();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationDomainTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationDomainTest.java
index 4544b0b..cd799b9 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationDomainTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ReplicationDomainTest.java
@@ -28,12 +28,11 @@
 
 import static org.opends.messages.ReplicationMessages.*;
 import static org.opends.server.TestCaseUtils.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
-import java.util.Arrays;
 import java.util.Map;
 import java.util.SortedSet;
-import java.util.TreeSet;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
@@ -302,8 +301,7 @@
       int replicationPort, String dirName, int windowSize,
       String... replServers) throws Exception
   {
-    return createReplicationServer(serverId, replicationPort, dirName,
-        windowSize, new TreeSet<String>(Arrays.asList(replServers)));
+    return createReplicationServer(serverId, replicationPort, dirName, windowSize, newTreeSet(replServers));
   }
 
   private ReplicationServer createReplicationServer(int serverId,
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tasks/TestBackupAndRestore.java b/opendj-server-legacy/src/test/java/org/opends/server/tasks/TestBackupAndRestore.java
index fac4d71..fb0d606 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/tasks/TestBackupAndRestore.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/tasks/TestBackupAndRestore.java
@@ -43,6 +43,7 @@
 
 import static org.assertj.core.api.Assertions.*;
 import static org.opends.server.api.TestTaskListener.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
@@ -160,25 +161,25 @@
 
   private String[] backupTask(String... additionalLdif)
   {
-    final ArrayList<String> l = new ArrayList<>(Arrays.asList(
+    final ArrayList<String> l = newArrayList(
         "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks",
         "objectclass: top",
         "objectclass: ds-task",
         "objectclass: ds-task-backup",
         "ds-task-class-name: org.opends.server.tasks.BackupTask",
-        "ds-backup-directory-path: bak"));
+        "ds-backup-directory-path: bak");
     l.addAll(Arrays.asList(additionalLdif));
     return l.toArray(new String[0]);
   }
 
   private String[] restoreTask(String... additionalLdif)
   {
-    final ArrayList<String> l = new ArrayList<>(Arrays.asList(
+    final ArrayList<String> l = newArrayList(
         "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks",
         "objectclass: top",
         "objectclass: ds-task",
         "objectclass: ds-task-restore",
-        "ds-task-class-name: org.opends.server.tasks.RestoreTask"));
+        "ds-task-class-name: org.opends.server.tasks.RestoreTask");
     l.addAll(Arrays.asList(additionalLdif));
     return l.toArray(new String[0]);
   }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java b/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
index 82ead66..fbd98d4 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
@@ -26,13 +26,13 @@
  */
 package org.opends.server.types;
 
-import org.forgerock.opendj.ldap.ByteString;
-
 import static org.assertj.core.api.Assertions.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 import java.util.*;
 
+import org.forgerock.opendj.ldap.ByteString;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.core.DirectoryServer;
 import org.testng.Assert;
@@ -47,7 +47,6 @@
 @SuppressWarnings("javadoc")
 public class AttributeBuilderTest extends TypesTestCase
 {
-
   /** CN attribute type used in all tests. */
   private AttributeType cnType;
 
@@ -1427,7 +1426,7 @@
           options.length)));
     }
 
-    List<String> tmp = new ArrayList<>(Arrays.asList(options));
+    List<String> tmp = newArrayList(options);
     tmp.add("xxxx");
     Assert.assertFalse(a.hasAllOptions(tmp));
 
@@ -1756,15 +1755,14 @@
       throws Exception
   {
     // Check optionsEquals.
-    Assert.assertTrue(a
-        .optionsEqual(new HashSet<String>(Arrays.asList(options))));
+    Assert.assertTrue(a.optionsEqual(newHashSet(options)));
 
     if (options.length > 1)
     {
       Assert.assertFalse(a.optionsEqual(Collections.singleton(options[0])));
     }
 
-    Set<String> stmp = new HashSet<>(Arrays.asList(options));
+    Set<String> stmp = newHashSet(options);
     stmp.add("xxxx");
     Assert.assertFalse(a.optionsEqual(stmp));
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java b/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java
index efe78bf..01e36b8 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java
@@ -26,6 +26,7 @@
  */
 package org.opends.server.util;
 
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 import java.io.BufferedReader;
@@ -1165,14 +1166,11 @@
         { Arrays.asList(0, 1), Arrays.asList(0, 1, 1), false },
 
         // Check multi-element sequential behaviour.
-        { new LinkedList<Integer>(Arrays.asList(0, 1)),
-            new LinkedList<Integer>(Arrays.asList(0, 1)), true },
-        { new LinkedList<Integer>(Arrays.asList(0, 1)),
-            new LinkedList<Integer>(Arrays.asList(1, 0)), false },
+        { newLinkedList(0, 1), newLinkedList(0, 1), true },
+        { newLinkedList(0, 1), newLinkedList(1, 0), false },
 
         // ...With duplicates.
-        { new LinkedList<Integer>(Arrays.asList(0, 1)),
-            new LinkedList<Integer>(Arrays.asList(0, 1, 1)), false } };
+        { newLinkedList(0, 1), newLinkedList(0, 1, 1), false } };
   }
 
   /**

--
Gitblit v1.10.0