From 9ddd1c3c61e88d6b0eaac1394b95f0fafa07a216 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 13 Jul 2015 09:59:22 +0000
Subject: [PATCH] Used CollectionUtils.newArrayList() and newLinkedList().

---
 opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java                     |   75 -
 opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java                                                     |    9 
 opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java                               |    5 
 opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java                          |    9 
 opendj-server-legacy/src/main/java/org/opends/quicksetup/UserData.java                                                        |   36 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java |   74 -
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/DBEnvironmentMonitoringTableModel.java          |   25 
 opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportConfig.java                                              |    4 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/AttributeValuePasswordValidatorTestCase.java                  |   33 
 opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java                              |   12 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MonitoringAttributesViewPanel.java                     |    7 
 opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java                                   |    7 
 opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java                                  |   14 
 opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java               |   68 -
 opendj-server-legacy/src/test/java/org/opends/server/extensions/TraditionalWorkQueueTestCase.java                             |   13 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java                         |    7 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java               |    4 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java                               |   13 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java        |   77 -
 opendj-server-legacy/src/test/java/org/opends/server/core/BackendConfigManagerTestCase.java                                   |   19 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/CharacterSetPasswordValidatorTestCase.java                    |   12 
 opendj-server-legacy/src/main/java/org/opends/server/types/CommonSchemaElements.java                                          |   21 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java                     |   22 
 opendj-server-legacy/src/main/java/org/opends/server/monitors/StackTraceMonitorProvider.java                                  |    7 
 opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java                               |    5 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyObjectClassTask.java                           |    4 
 opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java                                                      |   78 +-
 opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java                         |   47 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java                      |   12 
 opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java                                                    |   49 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java                 |   18 
 opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerDomain.java                          |    4 
 opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java                                                         |   59 -
 opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java                                               |    5 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java                     |   68 -
 opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java                                                  |   11 
 opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java                                          |   11 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java                              |   32 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java                  |    4 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java                            |   37 
 opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java                                                |   15 
 opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java                                         |    5 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyAttributeTask.java                             |    7 
 opendj-server-legacy/src/main/java/org/opends/server/types/SearchResultReference.java                                         |    7 
 opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java                                       |    8 
 opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java                                        |   11 
 opendj-server-legacy/src/test/java/org/opends/server/extensions/RepeatedCharactersPasswordValidatorTestCase.java              |  391 ++---------
 opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java                                                        |    7 
 opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java                                                     |   50 
 opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java                                 |   96 +-
 opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java                                              |    3 
 opendj-server-legacy/src/main/java/org/opends/server/config/ReadOnlyConfigAttribute.java                                      |    4 
 opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java                                              |   56 -
 opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java                                        |    8 
 opendj-server-legacy/src/test/java/org/opends/server/core/CompareOperationTestCase.java                                       |   44 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java                                    |    5 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java                               |   39 
 opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java                               |   73 -
 opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroupMemberList.java                                   |   17 
 opendj-server-legacy/src/test/java/org/opends/server/replication/StressTest.java                                              |   27 
 opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java                                                   |    3 
 61 files changed, 626 insertions(+), 1,267 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/DBEnvironmentMonitoringTableModel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/DBEnvironmentMonitoringTableModel.java
index 2f72726..ea0a438 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/DBEnvironmentMonitoringTableModel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/DBEnvironmentMonitoringTableModel.java
@@ -38,6 +38,7 @@
 
 import static org.opends.guitools.controlpanel.util.Utilities.*;
 import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 /**
  * The abstract table model used to display all the network groups.
@@ -132,21 +133,13 @@
     CustomSearchResult monitor1 = desc1.getMonitoringEntry();
     CustomSearchResult monitor2 = desc2.getMonitoringEntry();
 
-    ArrayList<Integer> possibleResults = new ArrayList<>();
-    possibleResults.add(getName(desc1).compareTo(getName(desc2)));
+    ArrayList<Integer> possibleResults = newArrayList(getName(desc1).compareTo(getName(desc2)));
     computeMonitoringPossibleResults(monitor1, monitor2, possibleResults, attributes);
 
     int result = possibleResults.get(getSortColumn());
     if (result == 0)
     {
-      for (int i : possibleResults)
-      {
-        if (i != 0)
-        {
-          result = i;
-          break;
-        }
-      }
+      result = getFirstNonZero(possibleResults);
     }
     if (!isSortAscending())
     {
@@ -155,6 +148,18 @@
     return result;
   }
 
+  private int getFirstNonZero(ArrayList<Integer> possibleResults)
+  {
+    for (int i : possibleResults)
+    {
+      if (i != 0)
+      {
+        return i;
+      }
+    }
+    return 0;
+  }
+
   /**
    * Returns whether the sort is ascending or descending.
    * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE>
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyAttributeTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyAttributeTask.java
index 703d903..9a579e2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyAttributeTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyAttributeTask.java
@@ -27,6 +27,7 @@
 package org.opends.guitools.controlpanel.task;
 
 import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -39,11 +40,11 @@
 
 import javax.swing.SwingUtilities;
 
+import org.forgerock.i18n.LocalizableMessage;
 import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
 import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
 import org.opends.guitools.controlpanel.ui.ProgressDialog;
 import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.ObjectClass;
 import org.opends.server.types.OpenDsException;
@@ -52,7 +53,6 @@
 /**
  * The task that is in charge of modifying an attribute definition (and all
  * the references to this attribute).
- *
  */
 public class ModifyAttributeTask extends Task
 {
@@ -248,8 +248,7 @@
   private void updateSchema() throws OpenDsException
   {
     Schema schema = getInfo().getServerDescriptor().getSchema();
-    ArrayList<AttributeType> attrs = new ArrayList<>();
-    attrs.add(oldAttribute);
+    ArrayList<AttributeType> attrs = newArrayList(oldAttribute);
     LinkedHashSet<AttributeType> attrsToDelete =
       DeleteSchemaElementsTask.getOrderedAttributesToDelete(attrs, schema);
     LinkedHashSet<ObjectClass> ocsToDelete =
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyObjectClassTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyObjectClassTask.java
index 84a2c79..e1357a3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyObjectClassTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyObjectClassTask.java
@@ -27,6 +27,7 @@
 package org.opends.guitools.controlpanel.task;
 
 import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -203,8 +204,7 @@
   private void updateSchema() throws OpenDsException
   {
     Schema schema = getInfo().getServerDescriptor().getSchema();
-    ArrayList<ObjectClass> ocs = new ArrayList<>();
-    ocs.add(oldObjectClass);
+    ArrayList<ObjectClass> ocs = newArrayList(oldObjectClass);
     LinkedHashSet<ObjectClass> ocsToDelete =
       DeleteSchemaElementsTask.getOrderedObjectClassesToDelete(ocs, schema);
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
index 1bdcf91..984c357 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
@@ -27,6 +27,8 @@
 package org.opends.guitools.controlpanel.ui;
 
 import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.server.types.CommonSchemaElements.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.awt.Component;
 import java.awt.Container;
@@ -69,33 +71,29 @@
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
 
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.ldap.schema.AttributeUsage;
+import org.forgerock.opendj.ldap.schema.MatchingRule;
+import org.forgerock.opendj.ldap.schema.Syntax;
 import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
 import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
-import org.opends.guitools.controlpanel.event.
- ConfigurationElementCreatedListener;
+import org.opends.guitools.controlpanel.event.ConfigurationElementCreatedListener;
 import org.opends.guitools.controlpanel.event.ScrollPaneBorderListener;
 import org.opends.guitools.controlpanel.task.DeleteSchemaElementsTask;
 import org.opends.guitools.controlpanel.task.ModifyAttributeTask;
 import org.opends.guitools.controlpanel.task.Task;
 import org.opends.guitools.controlpanel.ui.components.BasicExpander;
 import org.opends.guitools.controlpanel.ui.components.TitlePanel;
-import org.opends.guitools.controlpanel.ui.renderer.
- SchemaElementComboBoxCellRenderer;
+import org.opends.guitools.controlpanel.ui.renderer.SchemaElementComboBoxCellRenderer;
 import org.opends.guitools.controlpanel.util.LowerCaseComparator;
 import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.opends.server.types.AttributeType;
-import org.forgerock.opendj.ldap.schema.AttributeUsage;
 import org.opends.server.types.ObjectClass;
 import org.opends.server.types.Schema;
 import org.opends.server.util.ServerConstants;
 import org.opends.server.util.StaticUtils;
 
-import static org.opends.server.types.CommonSchemaElements.*;
-
 /**
  * The panel that displays a custom attribute definition.
  */
@@ -753,9 +751,9 @@
         availableMatchingRules.add(matchingRuleNameMap.get(key));
       }
       JComboBox[] combos = {approximate, equality, ordering, substring};
-      for (int i = 0; i < combos.length; i++)
+      for (JComboBox<LocalizableMessage> combo : combos)
       {
-        final DefaultComboBoxModel model = (DefaultComboBoxModel)combos[i].getModel();
+        final DefaultComboBoxModel<LocalizableMessage> model = (DefaultComboBoxModel) combo.getModel();
         final List<Object> el = new ArrayList<Object>(availableMatchingRules);
         if (model.getSize() == 0)
         {
@@ -1195,16 +1193,12 @@
     String f = file.getText().trim();
     if (f.length() > 0)
     {
-      ArrayList<String> list = new ArrayList<>();
-      list.add(f);
-      map.put(ServerConstants.SCHEMA_PROPERTY_FILENAME, list);
+      map.put(ServerConstants.SCHEMA_PROPERTY_FILENAME, newArrayList(f));
     }
     String or = origin.getText().trim();
     if (or.length() > 0)
     {
-      ArrayList<String> list = new ArrayList<>();
-      list.add(or);
-      map.put(ServerConstants.SCHEMA_PROPERTY_ORIGIN, list);
+      map.put(ServerConstants.SCHEMA_PROPERTY_ORIGIN, newArrayList(or));
     }
     return map;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
index 29260e1..d830128 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
@@ -27,6 +27,8 @@
 package org.opends.guitools.controlpanel.ui;
 
 import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.server.types.CommonSchemaElements.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.awt.Component;
 import java.awt.Container;
@@ -65,41 +67,32 @@
 import javax.swing.event.ListDataEvent;
 import javax.swing.event.ListDataListener;
 
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.ldap.schema.ObjectClassType;
 import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
 import org.opends.guitools.controlpanel.datamodel.SortableListModel;
 import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
-import org.opends.guitools.controlpanel.event.
- ConfigurationElementCreatedListener;
-import org.opends.guitools.controlpanel.event.SuperiorObjectClassesChangedEvent;
-import org.opends.guitools.controlpanel.event.
- SuperiorObjectClassesChangedListener;
+import org.opends.guitools.controlpanel.event.ConfigurationElementCreatedListener;
 import org.opends.guitools.controlpanel.event.ScrollPaneBorderListener;
+import org.opends.guitools.controlpanel.event.SuperiorObjectClassesChangedEvent;
+import org.opends.guitools.controlpanel.event.SuperiorObjectClassesChangedListener;
 import org.opends.guitools.controlpanel.task.DeleteSchemaElementsTask;
 import org.opends.guitools.controlpanel.task.ModifyObjectClassTask;
 import org.opends.guitools.controlpanel.task.Task;
 import org.opends.guitools.controlpanel.ui.components.BasicExpander;
 import org.opends.guitools.controlpanel.ui.components.DoubleAddRemovePanel;
-import org.opends.guitools.controlpanel.ui.components.
- SuperiorObjectClassesEditor;
+import org.opends.guitools.controlpanel.ui.components.SuperiorObjectClassesEditor;
 import org.opends.guitools.controlpanel.ui.components.TitlePanel;
-import org.opends.guitools.controlpanel.ui.renderer.
- SchemaElementComboBoxCellRenderer;
+import org.opends.guitools.controlpanel.ui.renderer.SchemaElementComboBoxCellRenderer;
 import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.ObjectClass;
-import org.forgerock.opendj.ldap.schema.ObjectClassType;
 import org.opends.server.types.Schema;
 import org.opends.server.util.ServerConstants;
 import org.opends.server.util.StaticUtils;
 
-import static org.opends.server.types.CommonSchemaElements.*;
-
-/**
- * The panel that displays a custom object class definition.
- *
- */
+/** The panel that displays a custom object class definition. */
 public class CustomObjectClassPanel extends SchemaElementPanel
 {
   private static final long serialVersionUID = 2105520588901380L;
@@ -964,16 +957,12 @@
     String f = file.getText().trim();
     if (f.length() > 0)
     {
-      ArrayList<String> list = new ArrayList<>();
-      list.add(f);
-      map.put(ServerConstants.SCHEMA_PROPERTY_FILENAME, list);
+      map.put(ServerConstants.SCHEMA_PROPERTY_FILENAME, newArrayList(f));
     }
     String or = origin.getText().trim();
     if (or.length() > 0)
     {
-      ArrayList<String> list = new ArrayList<>();
-      list.add(or);
-      map.put(ServerConstants.SCHEMA_PROPERTY_ORIGIN, list);
+      map.put(ServerConstants.SCHEMA_PROPERTY_ORIGIN, newArrayList(or));
     }
     return map;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MonitoringAttributesViewPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MonitoringAttributesViewPanel.java
index 17911fd..3833669 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MonitoringAttributesViewPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MonitoringAttributesViewPanel.java
@@ -27,6 +27,7 @@
 package org.opends.guitools.controlpanel.ui;
 
 import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.awt.Component;
 import java.awt.Dimension;
@@ -35,7 +36,6 @@
 import java.awt.Insets;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.LinkedHashSet;
 
@@ -52,7 +52,6 @@
 import org.forgerock.i18n.LocalizableMessage;
 
 /**
-*
 * The panel that allows the user to select which attributes must be displayed
 * in the traffic monitoring tables.
 *
@@ -300,9 +299,7 @@
    }
    if (selectedAttributes.isEmpty())
    {
-     ArrayList<LocalizableMessage> errors = new ArrayList<>();
-     errors.add(INFO_CTRL_PANEL_NO_OPERATION_SELECTED.get());
-     super.displayErrorDialog(errors);
+     super.displayErrorDialog(newArrayList(INFO_CTRL_PANEL_NO_OPERATION_SELECTED.get()));
    }
    else
    {
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java
index 5aab572..61ed818 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java
@@ -28,6 +28,7 @@
 package org.opends.guitools.controlpanel.ui;
 
 import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.awt.Component;
 import java.awt.GridBagConstraints;
@@ -56,37 +57,29 @@
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.ldap.schema.ObjectClassType;
 import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
 import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
-import org.opends.guitools.controlpanel.event.
- ConfigurationElementCreatedListener;
+import org.opends.guitools.controlpanel.event.ConfigurationElementCreatedListener;
 import org.opends.guitools.controlpanel.event.SuperiorObjectClassesChangedEvent;
-import org.opends.guitools.controlpanel.event.
- SuperiorObjectClassesChangedListener;
+import org.opends.guitools.controlpanel.event.SuperiorObjectClassesChangedListener;
 import org.opends.guitools.controlpanel.task.NewSchemaElementsTask;
 import org.opends.guitools.controlpanel.task.Task;
 import org.opends.guitools.controlpanel.ui.components.BasicExpander;
 import org.opends.guitools.controlpanel.ui.components.DoubleAddRemovePanel;
-import org.opends.guitools.controlpanel.ui.components.
- SuperiorObjectClassesEditor;
-import
-org.opends.guitools.controlpanel.ui.renderer.SchemaElementComboBoxCellRenderer;
+import org.opends.guitools.controlpanel.ui.components.SuperiorObjectClassesEditor;
+import org.opends.guitools.controlpanel.ui.renderer.SchemaElementComboBoxCellRenderer;
 import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.opends.server.config.ConfigConstants;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.ObjectClass;
-import org.forgerock.opendj.ldap.schema.ObjectClassType;
 import org.opends.server.types.Schema;
 import org.opends.server.util.ServerConstants;
 import org.opends.server.util.StaticUtils;
 
-/**
- * The panel displayed when the user wants to define a new object class in the
- * schema.
- *
- */
+/** The panel displayed when the user wants to define a new object class in the schema. */
 public class NewObjectClassPanel extends StatusGenericPanel
 {
  private static final long serialVersionUID = -4956885827963184571L;
@@ -416,11 +409,11 @@
       if (sel != null)
       {
         ArrayList<Integer> indexes = new ArrayList<>();
-        for (int j=0; j<sel.length; j++)
+        for (int element : sel)
         {
-          if (sel[j] < lists[i].getModel().getSize())
+          if (element < lists[i].getModel().getSize())
           {
-            indexes.add(sel[j]);
+            indexes.add(element);
           }
         }
         int[] newSelection = new int[indexes.size()];
@@ -660,16 +653,12 @@
     String f = file.getText().trim();
     if (f.length() > 0)
     {
-      ArrayList<String> list = new ArrayList<>();
-      list.add(f);
-      map.put(ServerConstants.SCHEMA_PROPERTY_FILENAME, list);
+      map.put(ServerConstants.SCHEMA_PROPERTY_FILENAME, newArrayList(f));
     }
     String or = origin.getText().trim();
     if (or.length() > 0)
     {
-      ArrayList<String> list = new ArrayList<>();
-      list.add(or);
-      map.put(ServerConstants.SCHEMA_PROPERTY_ORIGIN, list);
+      map.put(ServerConstants.SCHEMA_PROPERTY_ORIGIN, newArrayList(or));
     }
     return map;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
index 2f42048..0a2a61c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
@@ -28,6 +28,7 @@
 package org.opends.guitools.controlpanel.ui;
 
 import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.awt.Container;
 import java.awt.GridBagConstraints;
@@ -362,9 +363,7 @@
       {
         org.opends.server.types.Attribute attr =
           Attributes.create(rdn.getAttributeType(i), value);
-        ArrayList<ByteString> newValues = new ArrayList<>();
-        newValues.add(value);
-        entry.addAttribute(attr, newValues);
+        entry.addAttribute(attr, newArrayList(value));
       }
     }
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/UserData.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/UserData.java
index 76a6f5e..44caf3d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/UserData.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/UserData.java
@@ -41,6 +41,7 @@
 import org.opends.quicksetup.installer.NewSuffixOptions;
 import org.opends.quicksetup.installer.SuffixesToReplicateOptions;
 import org.opends.quicksetup.util.Utils;
+import org.opends.server.util.CollectionUtils;
 
 import com.forgerock.opendj.cli.CliConstants;
 
@@ -51,50 +52,30 @@
 public class UserData
 {
   private String serverLocation;
-
   private String hostName;
-
   private int serverPort;
-
   private int adminConnectorPort;
-
   private String directoryManagerDn;
-
   private String directoryManagerPwd;
-
   private String globalAdministratorUID;
-
   private String globalAdministratorPassword;
-
   private SecurityOptions securityOptions;
   private int serverJMXPort = -1;
 
   private boolean startServer;
-
   private boolean stopServer;
-
   private boolean enableWindowsService;
+  private boolean createAdministrator;
+  private boolean quiet;
+  private boolean verbose;
+  private boolean interactive;
+  private boolean forceOnError;
 
   private ManagedObjectDefinition<? extends BackendCfgClient, ? extends BackendCfg> backendType;
-
   private NewSuffixOptions newSuffixOptions;
-
   private DataReplicationOptions replicationOptions;
-
-  private boolean createAdministrator;
-
   private SuffixesToReplicateOptions suffixesToReplicateOptions;
-
-  private final Map<ServerDescriptor, AuthenticationData>
-  remoteWithNoReplicationPort;
-
-  private boolean quiet;
-
-  private boolean verbose;
-
-  private boolean interactive;
-
-  private boolean forceOnError;
+  private final Map<ServerDescriptor, AuthenticationData> remoteWithNoReplicationPort;
 
   private Map<String, JavaArguments> hmJavaArguments;
   private Map<String, JavaArguments> hmDefaultJavaArguments;
@@ -124,8 +105,7 @@
     forceOnError = true;
     verbose = false;
 
-    LinkedList<String> baseDn = new LinkedList<>();
-    baseDn.add("dc=example,dc=com");
+    LinkedList<String> baseDn = CollectionUtils.newLinkedList("dc=example,dc=com");
     NewSuffixOptions defaultNewSuffixOptions = NewSuffixOptions.createEmpty(baseDn);
     setNewSuffixOptions(defaultNewSuffixOptions);
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
index b4a6f3d..4058b74 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
@@ -30,6 +30,7 @@
 import static com.forgerock.opendj.util.OperatingSystem.*;
 
 import static org.opends.messages.QuickSetupMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -179,9 +180,7 @@
      * Runtime.exec (which is required to update the file system permissions).
      */
     Map<String, ArrayList<String>> permissions = new HashMap<>();
-    ArrayList<String> list = new ArrayList<>();
-    list.add(destDir);
-    permissions.put(getProtectedDirectoryPermissionUnix(), list);
+    permissions.put(getProtectedDirectoryPermissionUnix(), newArrayList(destDir));
     try {
       if(application != null) {
         application.checkAbort();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
index c71e989..12c8e45 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -2896,8 +2896,7 @@
     for (int i=0; i < rdn.getNumValues(); i++)
     {
       AttributeType type = rdn.getAttributeType(i);
-      List<Attribute> attrList = new LinkedList<>();
-      attrList.add(Attributes.create(type, rdn.getAttributeValue(i)));
+      List<Attribute> attrList = newLinkedList(Attributes.create(type, rdn.getAttributeValue(i)));
       if (type.isOperational())
       {
         operationalAttributes.put(type, attrList);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
index 01ce8c0..fc82d28 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
@@ -692,9 +692,8 @@
     {
       Entry taskEntry = getTaskEntry();
 
-      ArrayList<Modification> modifications = new ArrayList<>();
-      modifications.add(new Modification(ModificationType.REPLACE,
-          Attributes.create(name, value)));
+      List<Modification> modifications = newArrayList(
+          new Modification(ModificationType.REPLACE, Attributes.create(name, value)));
 
       taskEntry.applyModifications(modifications);
     }
@@ -976,13 +975,11 @@
       AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
           ATTR_TASK_LOG_MESSAGES.toLowerCase(), ATTR_TASK_LOG_MESSAGES);
 
-      List<Attribute> attrList = taskEntry.getAttribute(type);
+      final List<Attribute> attrList = taskEntry.getAttribute(type);
       ByteString value = ByteString.valueOf(messageString);
       if (attrList == null)
       {
-        attrList = new ArrayList<>();
-        attrList.add(Attributes.create(type, value));
-        taskEntry.putAttribute(type, attrList);
+        taskEntry.putAttribute(type, newArrayList(Attributes.create(type, value)));
       }
       else if (attrList.isEmpty())
       {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java
index a00055f..9f2cebb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java
@@ -40,6 +40,7 @@
 import org.forgerock.opendj.ldap.schema.Syntax;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.*;
+import org.opends.server.util.CollectionUtils;
 import org.forgerock.opendj.ldap.ByteString;
 import static org.opends.server.config.ConfigConstants.*;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -166,9 +167,7 @@
     this.hasUpperBound = hasUpperBound;
     this.upperBound    = upperBound;
 
-    activeValues = new ArrayList<>(1);
-    activeValues.add(value);
-
+    activeValues = CollectionUtils.newArrayList(value);
     pendingValues = activeValues;
   }
 
@@ -582,8 +581,7 @@
 
     if (requiresAdminAction())
     {
-      pendingValues = new ArrayList<>(1);
-      pendingValues.add(value);
+      pendingValues = CollectionUtils.newArrayList(value);
       setPendingValues(getValueSet(value));
     }
     else
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java b/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
index 3b1d3fd..aac293a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
@@ -71,6 +71,7 @@
 
 import static org.opends.messages.ConfigMessages.*;
 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.*;
 
@@ -415,9 +416,7 @@
 
           if (iterator.hasNext())
           {
-            List<String> stringValues = new ArrayList<>();
-            stringValues.add(value.toString());
-
+            List<String> stringValues = newArrayList(value.toString());
             while (iterator.hasNext())
             {
               value = iterator.next();
@@ -602,9 +601,7 @@
 
             if (iterator.hasNext())
             {
-              List<String> stringValues = new ArrayList<>();
-              stringValues.add(value.toString());
-
+              List<String> stringValues = newArrayList(value.toString());
               while (iterator.hasNext())
               {
                 value = iterator.next();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java
index 2ee6f18..5f09fd5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java
@@ -40,6 +40,7 @@
 import org.forgerock.opendj.ldap.schema.Syntax;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.*;
+import org.opends.server.util.CollectionUtils;
 import org.forgerock.opendj.ldap.ByteString;
 import static org.opends.server.config.ConfigConstants.*;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -145,8 +146,7 @@
     }
     else
     {
-      activeValues = new ArrayList<>(1);
-      activeValues.add(value);
+      activeValues = CollectionUtils.newArrayList(value);
     }
 
     pendingValues = activeValues;
@@ -412,8 +412,7 @@
 
     if (requiresAdminAction())
     {
-      pendingValues = new ArrayList<>(1);
-      pendingValues.add(value);
+      pendingValues = CollectionUtils.newArrayList(value);
       setPendingValues(getValueSet(value));
     }
     else
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/ReadOnlyConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/ReadOnlyConfigAttribute.java
index f183bdd..e454b5e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/ReadOnlyConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/ReadOnlyConfigAttribute.java
@@ -41,6 +41,7 @@
 import org.forgerock.opendj.ldap.ByteString;
 
 import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.messages.ConfigMessages.*;
 /**
  * This class defines a configuration attribute that is only intended for use
@@ -99,8 +100,7 @@
     }
     else
     {
-      values = new ArrayList<>(1);
-      values.add(value);
+      values = newArrayList(value);
     }
   }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java
index f60253e..6bace67 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java
@@ -42,6 +42,8 @@
 import org.opends.server.types.*;
 import org.forgerock.opendj.ldap.ByteString;
 import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.util.CollectionUtils.*;
+
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import static org.opends.messages.ConfigMessages.*;
 
@@ -127,8 +129,7 @@
     }
     else
     {
-      activeValues = new ArrayList<>(1);
-      activeValues.add(value);
+      activeValues = newArrayList(value);
     }
 
     pendingValues = activeValues;
@@ -357,8 +358,7 @@
 
     if (requiresAdminAction())
     {
-      pendingValues = new ArrayList<>(1);
-      pendingValues.add(value);
+      pendingValues = newArrayList(value);
       setPendingValues(getValueSet(value));
     }
     else
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 9218cf5..bdc51a3 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
@@ -31,6 +31,7 @@
 import static org.opends.messages.ToolMessages.*;
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.schema.SchemaConstants.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.DynamicConstants.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -5754,20 +5755,14 @@
                                        int supportedLDAPVersion,
                                        ConnectionHandler connectionHandler)
   {
-    List<ConnectionHandler> handlers =
-         directoryServer.supportedLDAPVersions.get(supportedLDAPVersion);
+    List<ConnectionHandler> handlers = directoryServer.supportedLDAPVersions.get(supportedLDAPVersion);
     if (handlers == null)
     {
-      handlers = new LinkedList<>();
-      handlers.add(connectionHandler);
-      directoryServer.supportedLDAPVersions.put(supportedLDAPVersion, handlers);
+      directoryServer.supportedLDAPVersions.put(supportedLDAPVersion, newLinkedList(connectionHandler));
     }
-    else
+    else if (!handlers.contains(connectionHandler))
     {
-      if (! handlers.contains(connectionHandler))
-      {
-        handlers.add(connectionHandler);
-      }
+      handlers.add(connectionHandler);
     }
   }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java
index 1ef1731..14d1c84 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java
@@ -28,6 +28,7 @@
 
 import static org.opends.messages.CoreMessages.*;
 import static org.opends.server.core.DirectoryServer.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.ALERT_DESCRIPTION_DISK_FULL;
 import static org.opends.server.util.ServerConstants.ALERT_DESCRIPTION_DISK_SPACE_LOW;
 import static org.opends.server.util.ServerConstants.ALERT_TYPE_DISK_FULL;
@@ -287,9 +288,7 @@
       List<MonitoredDirectory> diskHelpers = monitoredDirs.get(fsMountPoint);
       if (diskHelpers == null)
       {
-        List<MonitoredDirectory> newList = new ArrayList<>();
-        newList.add(newDSH);
-        monitoredDirs.put(fsMountPoint, newList);
+        monitoredDirs.put(fsMountPoint, newArrayList(newDSH));
       }
       else
       {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroupMemberList.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroupMemberList.java
index 8e9cfab..9dfea69 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroupMemberList.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroupMemberList.java
@@ -26,6 +26,8 @@
  */
 package org.opends.server.extensions;
 
+import static org.opends.server.util.CollectionUtils.*;
+
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
@@ -34,14 +36,14 @@
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
-import org.opends.server.types.DirectoryException;
+import org.forgerock.opendj.ldap.SearchScope;
 import org.opends.server.types.DN;
+import org.opends.server.types.DirectoryException;
 import org.opends.server.types.Entry;
 import org.opends.server.types.LDAPURL;
 import org.opends.server.types.MemberList;
 import org.opends.server.types.MembershipException;
 import org.opends.server.types.SearchFilter;
-import org.forgerock.opendj.ldap.SearchScope;
 
 /**
  * This class defines a mechanism that may be used to iterate over the
@@ -167,9 +169,7 @@
       // the same hierarchy.
       if (baseDNs.isEmpty())
       {
-        LinkedList<LDAPURL> urlList = new LinkedList<>();
-        urlList.add(memberURL);
-        baseDNs.put(urlBaseDN, urlList);
+        baseDNs.put(urlBaseDN, newLinkedList(memberURL));
       }
       else
       {
@@ -212,15 +212,12 @@
 
           if (! found)
           {
-            urlList = new LinkedList<>();
-            urlList.add(memberURL);
-            baseDNs.put(urlBaseDN, urlList);
+            baseDNs.put(urlBaseDN, newLinkedList(memberURL));
           }
         }
         else
         {
-          // There was already a list with the same base DN, so just add the
-          // URL.
+          // There was already a list with the same base DN, so just add the URL.
           urlList.add(memberURL);
         }
       }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java
index 7019317..cffd849 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java
@@ -45,17 +45,18 @@
 import org.opends.server.admin.std.server.GroupImplementationCfg;
 import org.opends.server.admin.std.server.StaticGroupImplementationCfg;
 import org.opends.server.api.Group;
-import org.opends.server.core.ModifyOperationBasis;
 import org.opends.server.core.DirectoryServer;
+import org.opends.server.core.ModifyOperation;
+import org.opends.server.core.ModifyOperationBasis;
 import org.opends.server.core.ServerContext;
 import org.opends.server.protocols.ldap.LDAPControl;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.Attributes;
 import org.opends.server.types.Control;
+import org.opends.server.types.DN;
 import org.opends.server.types.DirectoryConfig;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.DN;
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.MemberList;
@@ -66,6 +67,7 @@
 import static org.opends.messages.ExtensionMessages.*;
 import static org.opends.server.core.DirectoryServer.*;
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.forgerock.util.Reject.*;
 
@@ -322,15 +324,7 @@
         throw new DirectoryException(ResultCode.ATTRIBUTE_OR_VALUE_EXISTS, msg);
       }
 
-      Attribute attr = Attributes.create(memberAttributeType, nestedGroupDN.toString());
-      LinkedList<Modification> mods = new LinkedList<>();
-      mods.add(new Modification(ModificationType.ADD, attr));
-
-      LinkedList<Control> requestControls = new LinkedList<>();
-      requestControls.add(new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE, false));
-
-      ModifyOperationBasis modifyOperation = new ModifyOperationBasis(
-          getRootConnection(), nextOperationID(), nextMessageID(), requestControls, groupEntryDN, mods);
+      ModifyOperation modifyOperation = newModifyOperation(ModificationType.ADD, nestedGroupDN);
       modifyOperation.run();
       if (modifyOperation.getResultCode() != ResultCode.SUCCESS)
       {
@@ -364,15 +358,7 @@
                 ERR_STATICGROUP_REMOVE_NESTED_GROUP_NO_SUCH_GROUP.get(nestedGroupDN, groupEntryDN));
       }
 
-      Attribute attr = Attributes.create(memberAttributeType, nestedGroupDN.toString());
-      LinkedList<Modification> mods = new LinkedList<>();
-      mods.add(new Modification(ModificationType.DELETE, attr));
-
-      LinkedList<Control> requestControls = new LinkedList<>();
-      requestControls.add(new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE, false));
-
-      ModifyOperationBasis modifyOperation = new ModifyOperationBasis(
-          getRootConnection(), nextOperationID(), nextMessageID(), requestControls, groupEntryDN, mods);
+      ModifyOperation modifyOperation = newModifyOperation(ModificationType.DELETE, nestedGroupDN);
       modifyOperation.run();
       if (modifyOperation.getResultCode() != ResultCode.SUCCESS)
       {
@@ -520,15 +506,7 @@
         throw new DirectoryException(ResultCode.ATTRIBUTE_OR_VALUE_EXISTS, message);
       }
 
-      Attribute attr = Attributes.create(memberAttributeType, userDN.toString());
-      LinkedList<Modification> mods = new LinkedList<>();
-      mods.add(new Modification(ModificationType.ADD, attr));
-
-      LinkedList<Control> requestControls = new LinkedList<>();
-      requestControls.add(new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE, false));
-
-      ModifyOperationBasis modifyOperation = new ModifyOperationBasis(
-          getRootConnection(), nextOperationID(), nextMessageID(), requestControls, groupEntryDN, mods);
+      ModifyOperation modifyOperation = newModifyOperation(ModificationType.ADD, userDN);
       modifyOperation.run();
       if (modifyOperation.getResultCode() != ResultCode.SUCCESS)
       {
@@ -557,15 +535,7 @@
         throw new DirectoryException(ResultCode.NO_SUCH_ATTRIBUTE, message);
       }
 
-      Attribute attr = Attributes.create(memberAttributeType, userDN.toString());
-      LinkedList<Modification> mods = new LinkedList<>();
-      mods.add(new Modification(ModificationType.DELETE, attr));
-
-      LinkedList<Control> requestControls = new LinkedList<>();
-      requestControls.add(new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE, false));
-
-      ModifyOperationBasis modifyOperation = new ModifyOperationBasis(
-          getRootConnection(), nextOperationID(), nextMessageID(), requestControls, groupEntryDN, mods);
+      ModifyOperation modifyOperation = newModifyOperation(ModificationType.DELETE, userDN);
       modifyOperation.run();
       if (modifyOperation.getResultCode() != ResultCode.SUCCESS)
       {
@@ -585,6 +555,16 @@
     }
   }
 
+  private ModifyOperation newModifyOperation(ModificationType modType, DN userDN)
+  {
+    Attribute attr = Attributes.create(memberAttributeType, userDN.toString());
+    LinkedList<Modification> mods = newLinkedList(new Modification(modType, attr));
+    Control control = new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE, false);
+
+    return new ModifyOperationBasis(getRootConnection(), nextOperationID(), nextMessageID(),
+        newLinkedList(control), groupEntryDN, mods);
+  }
+
   /** {@inheritDoc} */
   @Override
   public void toString(StringBuilder buffer)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/monitors/StackTraceMonitorProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/monitors/StackTraceMonitorProvider.java
index 5ce2003..1ce0960 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/monitors/StackTraceMonitorProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/monitors/StackTraceMonitorProvider.java
@@ -26,7 +26,8 @@
  */
 package org.opends.server.monitors;
 
-import java.util.ArrayList;
+import static org.opends.server.util.CollectionUtils.*;
+
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
@@ -118,8 +119,6 @@
       }
     }
 
-    ArrayList<Attribute> attrs = new ArrayList<>();
-    attrs.add(builder.toAttribute());
-    return attrs;
+    return newArrayList(builder.toAttribute());
   }
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java
index becc153..0739a7b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java
@@ -46,6 +46,7 @@
 
 import static org.opends.messages.ProtocolMessages.*;
 import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 
@@ -115,34 +116,14 @@
     try
     {
       LinkedHashMap<ObjectClass,String> objectClasses = new LinkedHashMap<>();
-      ObjectClass topOC = DirectoryServer.getTopObjectClass();
-      ObjectClass personOC = DirectoryServer.getObjectClass(OC_PERSON, true);
-      ObjectClass rootOC = DirectoryServer.getObjectClass(OC_ROOT_DN, true);
-
-      objectClasses.put(topOC, topOC.getPrimaryName());
-      objectClasses.put(personOC, personOC.getPrimaryName());
-      objectClasses.put(rootOC, rootOC.getPrimaryName());
-
+      put(objectClasses, DirectoryServer.getTopObjectClass());
+      put(objectClasses, DirectoryServer.getObjectClass(OC_PERSON, true));
+      put(objectClasses, DirectoryServer.getObjectClass(OC_ROOT_DN, true));
 
       LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>();
-      AttributeType cnAT = DirectoryServer.getAttributeTypeOrDefault(ATTR_COMMON_NAME);
-      AttributeType snAT = DirectoryServer.getAttributeTypeOrDefault(ATTR_SN);
-      AttributeType altDNAT = DirectoryServer.getAttributeTypeOrDefault(ATTR_ROOTDN_ALTERNATE_BIND_DN);
-
-      LinkedList<Attribute> attrList = new LinkedList<>();
-      attrList.add(Attributes.create(ATTR_COMMON_NAME, commonName));
-      userAttrs.put(cnAT, attrList);
-
-      attrList = new LinkedList<>();
-      attrList.add(Attributes.create(ATTR_SN, commonName));
-      userAttrs.put(snAT, attrList);
-
-      attrList = new LinkedList<>();
-      attrList.add(Attributes.create(ATTR_ROOTDN_ALTERNATE_BIND_DN, shortDNString));
-      userAttrs.put(altDNAT, attrList);
-
-
-      LinkedHashMap<AttributeType,List<Attribute>> operationalAttrs = new LinkedHashMap<>();
+      put(userAttrs, ATTR_COMMON_NAME, commonName);
+      put(userAttrs, ATTR_SN, commonName);
+      put(userAttrs, ATTR_ROOTDN_ALTERNATE_BIND_DN, shortDNString);
 
       AttributeType privType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PRIVILEGE_NAME);
       AttributeBuilder builder = new AttributeBuilder(privType);
@@ -150,10 +131,9 @@
       {
         builder.add(p.getName());
       }
-      attrList = new LinkedList<>();
-      attrList.add(builder.toAttribute());
 
-      operationalAttrs.put(privType, attrList);
+      LinkedHashMap<AttributeType, List<Attribute>> operationalAttrs = new LinkedHashMap<>();
+      operationalAttrs.put(privType, builder.toAttributeList());
 
 
       DN internalUserDN = DN.valueOf(fullDNString);
@@ -177,7 +157,16 @@
     connectionID  = nextConnectionID.getAndDecrement();
   }
 
+  private void put(Map<ObjectClass, String> objectClasses, ObjectClass oc)
+  {
+    objectClasses.put(oc, oc.getPrimaryName());
+  }
 
+  private void put(Map<AttributeType, List<Attribute>> Attrs, String attrName, String value)
+  {
+    List<Attribute> attrs = newLinkedList(Attributes.create(attrName, value));
+    Attrs.put(DirectoryServer.getAttributeTypeOrDefault(attrName), attrs);
+  }
 
   /**
    * Creates a new internal client connection that will be
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java
index 53af3b0..77e1a18 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java
@@ -27,6 +27,7 @@
 package org.opends.server.replication.plugin;
 
 import static org.opends.messages.ReplicationMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.util.*;
 
@@ -181,17 +182,14 @@
     List<Modification> mods = modifyOperation.getModifications();
     CSN modOpCSN = OperationContext.getCSN(modifyOperation);
 
-    for (Iterator<Modification> modsIterator = mods.iterator();
-         modsIterator.hasNext(); )
+    for (Iterator<Modification> it = mods.iterator(); it.hasNext(); )
     {
-      // Traverse the mods of this MOD operation
-      Modification m = modsIterator.next();
+      Modification m = it.next();
 
       // Read or create the attr historical for the attribute type and option
       // contained in the mod
       AttrHistorical attrHist = getOrCreateAttrHistorical(m);
-
-      if (attrHist.replayOperation(modsIterator, modOpCSN, modifiedEntry, m))
+      if (attrHist.replayOperation(it, modOpCSN, modifiedEntry, m))
       {
         bConflict = true;
       }
@@ -323,9 +321,7 @@
     Attribute attr = Attributes.create(historicalAttrType, attrValue);
 
     // Set the created attribute to the operation
-    List<Attribute> attrList = new LinkedList<>();
-    attrList.add(attr);
-    addOperation.setAttribute(historicalAttrType, attrList);
+    addOperation.setAttribute(historicalAttrType, newLinkedList(attr));
   }
 
   /**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerDomain.java
index 8a6b5f5..99bbc79 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -81,6 +81,7 @@
 import static org.opends.server.replication.protocol.ProtocolVersion.*;
 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.opends.server.util.StaticUtils.*;
 
 /**
@@ -1647,8 +1648,7 @@
     }
 
     // Create info for the local RS
-    List<RSInfo> rsInfos = new ArrayList<>();
-    rsInfos.add(toRSInfo(localReplicationServer, generationId));
+    List<RSInfo> rsInfos = newArrayList(toRSInfo(localReplicationServer, generationId));
 
     return new TopologyMsg(dsInfos, rsInfos);
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java
index 284d231..6fb9d27 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java
@@ -29,6 +29,7 @@
 import static org.opends.messages.ReplicationMessages.*;
 import static org.opends.server.replication.common.AssuredMode.*;
 import static org.opends.server.replication.common.StatusMachine.*;
+import static org.opends.server.util.CollectionUtils.*;
 
 import java.io.BufferedOutputStream;
 import java.io.IOException;
@@ -3195,9 +3196,7 @@
             //   -> replay error occurred
             ackMsg.setHasReplayError(true);
             //   -> replay error occurred in our server
-            List<Integer> idList = new ArrayList<>();
-            idList.add(getServerId());
-            ackMsg.setFailedServers(idList);
+            ackMsg.setFailedServers(newArrayList(getServerId()));
           }
           broker.publish(ackMsg);
           if (replayErrorMsg != null)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java
index 1ae2ee8..299f5ba 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java
@@ -25,6 +25,7 @@
  *      Portions Copyright 2013-2015 ForgeRock AS.
  */
 package org.opends.server.tools;
+
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
@@ -71,11 +72,11 @@
 import static org.opends.messages.ToolMessages.*;
 import static org.opends.server.protocols.ldap.LDAPResultCode.*;
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
+
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 import static com.forgerock.opendj.cli.Utils.filterExitCode;
 
-
-
 /**
  * This class provides a program that may be used to determine the differences
  * between two LDIF files, generating the output in LDIF change format.  There
@@ -759,8 +760,7 @@
    *                       change record.
    */
   private static boolean writeModify(LDIFWriter writer, Entry sourceEntry,
-                                     Entry targetEntry, Collection ignoreAttrs,
-                                     boolean singleValueChanges)
+      Entry targetEntry, Collection<String> ignoreAttrs, boolean singleValueChanges)
           throws IOException
   {
     // Create a list to hold the modifications that are found.
@@ -860,24 +860,20 @@
           else
           {
             // Compare the values.
-            AttributeBuilder addedValuesBuilder = new AttributeBuilder(
-                targetAttr);
+            AttributeBuilder addedValuesBuilder = new AttributeBuilder(targetAttr);
             addedValuesBuilder.removeAll(sourceAttr);
             Attribute addedValues = addedValuesBuilder.toAttribute();
             if (!addedValues.isEmpty())
             {
-              modifications.add(new Modification(ModificationType.ADD,
-                  addedValues));
+              modifications.add(new Modification(ModificationType.ADD, addedValues));
             }
 
-            AttributeBuilder deletedValuesBuilder = new AttributeBuilder(
-                sourceAttr);
+            AttributeBuilder deletedValuesBuilder = new AttributeBuilder(sourceAttr);
             deletedValuesBuilder.removeAll(targetAttr);
             Attribute deletedValues = deletedValuesBuilder.toAttribute();
             if (!deletedValues.isEmpty())
             {
-              modifications.add(new Modification(ModificationType.DELETE,
-                  deletedValues));
+              modifications.add(new Modification(ModificationType.DELETE, deletedValues));
             }
           }
         }
@@ -920,41 +916,37 @@
     {
       return false;
     }
-    else
-    {
-      if (singleValueChanges)
-      {
-        for (Modification m : modifications)
-        {
-          Attribute a = m.getAttribute();
-          if (a.isEmpty())
-          {
-            LinkedList<Modification> attrMods = new LinkedList<>();
-            attrMods.add(m);
-            writer.writeModifyChangeRecord(sourceEntry.getName(), attrMods);
-          }
-          else
-          {
-            LinkedList<Modification> attrMods = new LinkedList<>();
-            for (ByteString v : a)
-            {
-              AttributeBuilder builder = new AttributeBuilder(a, true);
-              builder.add(v);
-              Attribute attr = builder.toAttribute();
 
-              attrMods.clear();
-              attrMods.add(new Modification(m.getModificationType(), attr));
-              writer.writeModifyChangeRecord(sourceEntry.getName(), attrMods);
-            }
+    if (singleValueChanges)
+    {
+      for (Modification m : modifications)
+      {
+        Attribute a = m.getAttribute();
+        if (a.isEmpty())
+        {
+          writer.writeModifyChangeRecord(sourceEntry.getName(), newLinkedList(m));
+        }
+        else
+        {
+          LinkedList<Modification> attrMods = new LinkedList<>();
+          for (ByteString v : a)
+          {
+            AttributeBuilder builder = new AttributeBuilder(a, true);
+            builder.add(v);
+            Attribute attr = builder.toAttribute();
+
+            attrMods.clear();
+            attrMods.add(new Modification(m.getModificationType(), attr));
+            writer.writeModifyChangeRecord(sourceEntry.getName(), attrMods);
           }
         }
       }
-      else
-      {
-        writer.writeModifyChangeRecord(sourceEntry.getName(), modifications);
-      }
-
-      return true;
     }
+    else
+    {
+      writer.writeModifyChangeRecord(sourceEntry.getName(), modifications);
+    }
+
+    return true;
   }
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java
index 960d203..712e527 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java
@@ -30,6 +30,7 @@
 import static com.forgerock.opendj.cli.Utils.*;
 
 import static org.opends.messages.ToolMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.StaticUtils.*;
 
 import java.io.BufferedReader;
@@ -131,7 +132,7 @@
     StringArgument      filterFile;
     IntegerArgument     sizeLimit;
     IntegerArgument     timeLimit;
-    MultiChoiceArgument scopeString;
+    MultiChoiceArgument<String> scopeString;
     StringArgument      baseDNString;
     StringArgument      configClass;
     StringArgument      configFile;
@@ -161,7 +162,7 @@
               INFO_LDIFSEARCH_DESCRIPTION_BASEDN.get());
       argParser.addArgument(baseDNString);
 
-      scopeString = new MultiChoiceArgument(
+      scopeString = new MultiChoiceArgument<>(
               "scope", 's', "searchScope", false, false,
               true, INFO_SCOPE_PLACEHOLDER.get(), SCOPE_STRING_SUB,
               null, scopeStrings, false,
@@ -338,32 +339,28 @@
         err.println(message);
         return 1;
       }
-      else
+
+      Iterator<String> iterator = trailingArguments.iterator();
+      filterStrings = newLinkedList(iterator.next());
+
+      while (iterator.hasNext())
       {
-        Iterator<String> iterator = trailingArguments.iterator();
-
-        filterStrings = new LinkedList<>();
-        filterStrings.add(iterator.next());
-
-        while (iterator.hasNext())
+        String lowerName = toLowerCase(iterator.next());
+        if (lowerName.equals("*"))
         {
-          String lowerName = toLowerCase(iterator.next());
-          if (lowerName.equals("*"))
-          {
-            allUserAttrs = true;
-          }
-          else if (lowerName.equals("+"))
-          {
-            allOperationalAttrs = true;
-          }
-          else if (lowerName.startsWith("@"))
-          {
-            objectClassNames.add(lowerName.substring(1));
-          }
-          else
-          {
-            attributeNames.add(lowerName);
-          }
+          allUserAttrs = true;
+        }
+        else if (lowerName.equals("+"))
+        {
+          allOperationalAttrs = true;
+        }
+        else if (lowerName.startsWith("@"))
+        {
+          objectClassNames.add(lowerName.substring(1));
+        }
+        else
+        {
+          attributeNames.add(lowerName);
         }
       }
     }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/CommonSchemaElements.java b/opendj-server-legacy/src/main/java/org/opends/server/types/CommonSchemaElements.java
index 28b344c..017c9ec 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/CommonSchemaElements.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/CommonSchemaElements.java
@@ -38,6 +38,7 @@
 
 import static org.forgerock.util.Reject.*;
 import static org.opends.messages.SchemaMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 
@@ -310,13 +311,11 @@
    * @return The name or OID for this schema definition.
    */
   public final String getNameOrOID() {
-
     if (primaryName != null) {
       return primaryName;
-    } else {
-      // Guaranteed not to be null.
-      return oid;
     }
+    // Guaranteed not to be null.
+    return oid;
   }
 
   /**
@@ -327,13 +326,11 @@
    * @return The name or OID for this schema definition.
    */
   public final String getNormalizedPrimaryNameOrOID() {
-
     if (lowerName != null) {
       return lowerName;
-    } else {
-      // Guaranteed not to be null.
-      return oid;
     }
+    // Guaranteed not to be null.
+    return oid;
   }
 
 
@@ -452,8 +449,7 @@
    * @param  name   The name for the "extra" property.  It must not be
    *                {@code null}.
    * @param  value  The value for the "extra" property.  If it is
-   *                {@code null}, then any existing definition will be
-   *                removed.
+   *                {@code null}, then any existing definition will be removed.
    */
   public static void setExtraProperty(SchemaFileElement elem,
       String name, String value)
@@ -466,10 +462,7 @@
     }
     else
     {
-      LinkedList<String> values = new LinkedList<>();
-      values.add(value);
-
-      elem.getExtraProperties().put(name, values);
+      elem.getExtraProperties().put(name, newLinkedList(value));
     }
   }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
index 00270e9..e99ebd7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -699,12 +699,10 @@
       }
     }
 
-    if (lowerName.equals(OBJECTCLASS_ATTRIBUTE_TYPE_NAME) &&
-        (! objectClasses.isEmpty()))
+    if (lowerName.equals(OBJECTCLASS_ATTRIBUTE_TYPE_NAME)
+        && !objectClasses.isEmpty())
     {
-      List<Attribute> attrList = new LinkedList<>();
-      attrList.add(getObjectClassAttribute());
-      return attrList;
+      return newLinkedList(getObjectClassAttribute());
     }
     return null;
   }
@@ -839,11 +837,9 @@
     }
 
     if (lowerName.equals(OBJECTCLASS_ATTRIBUTE_TYPE_NAME) &&
-        ((options == null) || options.isEmpty()))
+        (options == null || options.isEmpty()))
     {
-      List<Attribute> attributes = new LinkedList<>();
-      attributes.add(getObjectClassAttribute());
-      return attributes;
+      return newLinkedList(getObjectClassAttribute());
     }
     return null;
   }
@@ -3136,19 +3132,14 @@
             attrList = operationalAttributes.get(attributeType);
             if (attrList == null || attrList.isEmpty())
             {
-              // There aren't any conflicts, so we can just add the
-              // attribute to the entry.
-              attrList = new LinkedList<>();
-              attrList.add(collectiveAttr);
-              putAttributes(attributeType, attrList);
+              // There aren't any conflicts, so we can just add the attribute to the entry.
+              putAttributes(attributeType, newLinkedList(collectiveAttr));
             }
             else
             {
-              // There is a conflict with an existing operational
-              // attribute.
+              // There is a conflict with an existing operational attribute.
               resolveCollectiveConflict(subEntry.getConflictBehavior(),
-                  collectiveAttr, attrList, operationalAttributes,
-                  attributeType);
+                  collectiveAttr, attrList, operationalAttributes, attributeType);
             }
           }
           else
@@ -3198,8 +3189,7 @@
     if (attrList.get(0).isVirtual())
     {
       // The existing attribute is already virtual,
-      // so we've got a different conflict, but
-      // we'll let the first win.
+      // so we've got a different conflict, but we'll let the first win.
       // FIXME -- Should we handle this differently?
       return;
     }
@@ -3214,13 +3204,10 @@
       break;
 
     case VIRTUAL_OVERRIDES_REAL:
-      // We need to move the real attribute to the
-      // suppressed list and replace it with the
-      // virtual attribute.
+      // We need to move the real attribute to the suppressed list
+      // and replace it with the virtual attribute.
       suppressedAttributes.put(attributeType, attrList);
-      attrList = new LinkedList<>();
-      attrList.add(collectiveAttr);
-      attributes.put(attributeType, attrList);
+      attributes.put(attributeType, newLinkedList(collectiveAttr));
       break;
 
     case MERGE_REAL_AND_VIRTUAL:
@@ -3240,9 +3227,7 @@
    */
   public void processVirtualAttributes()
   {
-    // Virtual attributes.
-    for (VirtualAttributeRule rule :
-         DirectoryServer.getVirtualAttributes(this))
+    for (VirtualAttributeRule rule : DirectoryServer.getVirtualAttributes(this))
     {
       AttributeType attributeType = rule.getAttributeType();
       List<Attribute> attrList = userAttributes.get(attributeType);
@@ -3251,17 +3236,14 @@
         attrList = operationalAttributes.get(attributeType);
         if (attrList == null || attrList.isEmpty())
         {
-          // There aren't any conflicts, so we can just add the
-          // attribute to the entry.
-          attrList = new LinkedList<>();
-          attrList.add(new VirtualAttribute(attributeType, this, rule));
-          putAttributes(attributeType, attrList);
+          // There aren't any conflicts, so we can just add the attribute to the entry.
+          Attribute attr = new VirtualAttribute(attributeType, this, rule);
+          putAttributes(attributeType, newLinkedList(attr));
         }
         else
         {
           // There is a conflict with an existing operational attribute.
-          resolveVirtualConflict(rule, attrList, operationalAttributes,
-              attributeType);
+          resolveVirtualConflict(rule, attrList, operationalAttributes, attributeType);
         }
       }
       else
@@ -3312,9 +3294,8 @@
       // We need to move the real attribute to the suppressed
       // list and replace it with the virtual attribute.
       suppressedAttributes.put(attributeType, attrList);
-      attrList = new LinkedList<>();
-      attrList.add(new VirtualAttribute(attributeType, this, rule));
-      attributes.put(attributeType, attrList);
+      Attribute attr = new VirtualAttribute(attributeType, this, rule);
+      attributes.put(attributeType, newLinkedList(attr));
       break;
 
     case MERGE_REAL_AND_VIRTUAL:
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportConfig.java b/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportConfig.java
index a19684f..70da7ff 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportConfig.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/LDIFImportConfig.java
@@ -35,6 +35,7 @@
 import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1;
 import org.opends.server.tools.makeldif.MakeLDIFInputStream;
 import org.opends.server.tools.makeldif.TemplateFile;
+import org.opends.server.util.CollectionUtils;
 import org.opends.server.util.StaticUtils;
 
 /**
@@ -134,8 +135,7 @@
    */
   public LDIFImportConfig(String ldifFile)
   {
-    ldifFiles = new ArrayList<>(1);
-    ldifFiles.add(ldifFile);
+    ldifFiles = CollectionUtils.newArrayList(ldifFile);
     ldifFileIterator = ldifFiles.iterator();
   }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
index ead7891..7fbbaee 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
@@ -43,8 +43,8 @@
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ModificationType;
 import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.ldap.schema.Syntax;
 import org.forgerock.opendj.ldap.schema.MatchingRule;
+import org.forgerock.opendj.ldap.schema.Syntax;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.SchemaConfigManager;
 import org.opends.server.schema.AttributeTypeSyntax;
@@ -59,6 +59,7 @@
 import static org.opends.messages.CoreMessages.*;
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.types.CommonSchemaElements.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 
@@ -384,9 +385,7 @@
     if (subTypes == null)
     {
       superiorType.setMayHaveSubordinateTypes();
-      subTypes = new LinkedList<>();
-      subTypes.add(attributeType);
-      subordinateTypes.put(superiorType, subTypes);
+      subordinateTypes.put(superiorType, newLinkedList(attributeType));
     }
     else if (! subTypes.contains(attributeType))
     {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/SearchResultReference.java b/opendj-server-legacy/src/main/java/org/opends/server/types/SearchResultReference.java
index 0a55cb2..cec25bc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/SearchResultReference.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/SearchResultReference.java
@@ -30,8 +30,7 @@
 import java.util.List;
 import java.util.Iterator;
 
-
-
+import org.opends.server.util.CollectionUtils;
 
 /**
  * This class defines a data structure for storing information about a
@@ -61,9 +60,7 @@
    */
   public SearchResultReference(String referralURL)
   {
-    referralURLs = new ArrayList<>(1);
-    referralURLs.add(referralURL);
-
+    referralURLs = CollectionUtils.newArrayList(referralURL);
     this.controls = new ArrayList<>(0);
   }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java b/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java
index 0b62484..27430fc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java
@@ -114,8 +114,7 @@
     this.sender  = sender;
     this.subject = subject;
 
-    recipients = new ArrayList<>();
-    recipients.add(recipient);
+    recipients = CollectionUtils.newArrayList(recipient);
 
     body         = new LocalizableMessageBuilder();
     attachments  = new LinkedList<>();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
index 0f2d16c..48b66c5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
@@ -28,6 +28,7 @@
 
 import static org.forgerock.util.Reject.*;
 import static org.opends.messages.UtilityMessages.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.StaticUtils.*;
 
 import java.io.BufferedReader;
@@ -892,14 +893,13 @@
       {
         attrBuilders = userAttrBuilders;
       }
-      List<AttributeBuilder> attrList = attrBuilders.get(attrType);
+
+      final List<AttributeBuilder> attrList = attrBuilders.get(attrType);
       if (attrList == null)
       {
         AttributeBuilder builder = new AttributeBuilder(attribute, true);
         builder.add(attributeValue);
-        attrList = new ArrayList<>();
-        attrList.add(builder);
-        attrBuilders.put(attrType, attrList);
+        attrBuilders.put(attrType, newArrayList(builder));
         return;
       }
 
@@ -1705,40 +1705,32 @@
       Map<AttributeType, List<Attribute>> attributes, AttributeType t,
       ByteString v, String n)
   {
-    List<Attribute> attrList = attributes.get(t);
+    final List<Attribute> attrList = attributes.get(t);
     if (attrList == null)
     {
-      attrList = new ArrayList<>();
-      attrList.add(Attributes.create(t, n, v));
-      attributes.put(t, attrList);
+      attributes.put(t, newArrayList(Attributes.create(t, n, v)));
+      return;
     }
-    else
+
+    for (int j = 0; j < attrList.size(); j++)
     {
-      boolean found = false;
-      for (int j = 0; j < attrList.size(); j++)
+      Attribute a = attrList.get(j);
+      if (a.hasOptions())
       {
-        Attribute a = attrList.get(j);
-
-        if (a.hasOptions())
-        {
-          continue;
-        }
-
-        if (!a.contains(v))
-        {
-          AttributeBuilder builder = new AttributeBuilder(a);
-          builder.add(v);
-          attrList.set(j, builder.toAttribute());
-        }
-
-        found = true;
-        break;
+        continue;
       }
 
-      if (!found)
+      if (!a.contains(v))
       {
-        attrList.add(Attributes.create(t, n, v));
+        AttributeBuilder builder = new AttributeBuilder(a);
+        builder.add(v);
+        attrList.set(j, builder.toAttribute());
       }
+
+      return;
     }
+
+    // not found
+    attrList.add(Attributes.create(t, n, v));
   }
 }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
index c6c8474..11cd04a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
@@ -26,7 +26,6 @@
  */
 package org.opends.server.workflowelement.localbackend;
 
-import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -642,58 +641,43 @@
       Map<AttributeType, List<Attribute>> attributes, AttributeType t,
       ByteString v, String n) throws DirectoryException
   {
-    List<Attribute> attrList = attributes.get(t);
+    final List<Attribute> attrList = attributes.get(t);
     if (attrList == null)
     {
-      if (isSynchronizationOperation() ||
-          DirectoryServer.addMissingRDNAttributes())
-      {
-        attrList = new ArrayList<>();
-        attrList.add(Attributes.create(t, n, v));
-        attributes.put(t, attrList);
-      }
-      else
+      if (!isSynchronizationOperation()
+          && !DirectoryServer.addMissingRDNAttributes())
       {
         throw newDirectoryException(entryDN, ResultCode.CONSTRAINT_VIOLATION,
             ERR_ADD_MISSING_RDN_ATTRIBUTE.get(entryDN, n));
       }
+      attributes.put(t, newArrayList(Attributes.create(t, n, v)));
+      return;
     }
-    else
-    {
-      boolean found = false;
-      for (int j = 0; j < attrList.size(); j++) {
-        Attribute a = attrList.get(j);
 
-        if (a.hasOptions())
-        {
-          continue;
-        }
-
-        if (!a.contains(v))
-        {
-          AttributeBuilder builder = new AttributeBuilder(a);
-          builder.add(v);
-          attrList.set(j, builder.toAttribute());
-        }
-
-        found = true;
-        break;
-      }
-
-      if (!found)
+    for (int j = 0; j < attrList.size(); j++) {
+      Attribute a = attrList.get(j);
+      if (a.hasOptions())
       {
-        if (isSynchronizationOperation() ||
-            DirectoryServer.addMissingRDNAttributes())
-        {
-          attrList.add(Attributes.create(t, n, v));
-        }
-        else
-        {
-          throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
-              ERR_ADD_MISSING_RDN_ATTRIBUTE.get(entryDN, n));
-        }
+        continue;
       }
+
+      if (!a.contains(v))
+      {
+        AttributeBuilder builder = new AttributeBuilder(a);
+        builder.add(v);
+        attrList.set(j, builder.toAttribute());
+      }
+
+      return;
     }
+
+    // not found
+    if (!isSynchronizationOperation() && !DirectoryServer.addMissingRDNAttributes())
+    {
+      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
+          ERR_ADD_MISSING_RDN_ATTRIBUTE.get(entryDN, n));
+    }
+    attrList.add(Attributes.create(t, n, v));
   }
 
 
diff --git a/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java b/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
index 52666ce..e2d8af3 100644
--- a/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
@@ -31,7 +31,6 @@
 
 import java.net.InetAddress;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 
 import org.forgerock.opendj.ldap.ByteString;
@@ -57,6 +56,8 @@
 import org.forgerock.opendj.ldap.responses.GenericExtendedResult;
 import org.forgerock.opendj.ldap.responses.Responses;
 import org.forgerock.opendj.ldap.responses.Result;
+import org.opends.server.DirectoryServerTestCase;
+import org.opends.server.TestCaseUtils;
 import org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.Scope;
 import org.opends.server.core.BindOperation;
 import org.opends.server.core.CompareOperation;
@@ -65,8 +66,6 @@
 import org.opends.server.core.SearchOperation;
 import org.opends.server.protocols.ldap.LDAPControl;
 import org.opends.server.protocols.ldap.LDAPFilter;
-import org.opends.server.DirectoryServerTestCase;
-import org.opends.server.TestCaseUtils;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.Attributes;
 import org.opends.server.types.DirectoryException;
@@ -75,6 +74,7 @@
 import org.opends.server.types.Operation;
 import org.opends.server.types.SearchResultEntry;
 import org.opends.server.types.SearchResultReference;
+import org.opends.server.util.CollectionUtils;
 import org.testng.annotations.BeforeGroups;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -239,11 +239,7 @@
                         .newControl("dn:uid=kvaughan,ou=People,dc=example,dc=com");
         assertThat(control3.getOID()).isEqualTo("2.16.840.1.113730.3.4.18");
 
-        List<org.forgerock.opendj.ldap.controls.Control> mySDKControlsList = new LinkedList<>();
-        mySDKControlsList.add(control);
-        mySDKControlsList.add(control2);
-        mySDKControlsList.add(control3);
-        return mySDKControlsList;
+        return CollectionUtils.newLinkedList(control, control2, control3);
     }
 
     /**
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/BackendConfigManagerTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/BackendConfigManagerTestCase.java
index 6c7d24e..402b2ef 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/BackendConfigManagerTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/BackendConfigManagerTestCase.java
@@ -28,7 +28,6 @@
 
 import java.util.ArrayList;
 
-import org.forgerock.opendj.ldap.ModificationType;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.SearchScope;
 import org.opends.server.TestCaseUtils;
@@ -45,9 +44,11 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import static org.forgerock.opendj.ldap.ModificationType.*;
 import static org.opends.server.TestCaseUtils.*;
 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.testng.Assert.*;
 
 /**
@@ -195,9 +196,7 @@
 
     InternalClientConnection conn = getRootConnection();
     // Modify the backend to enable it.
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-enabled", "true")));
+    ArrayList<Modification> mods = newArrayList(new Modification(REPLACE, Attributes.create("ds-cfg-enabled", "true")));
     ModifyOperation modifyOperation =
          conn.processModify(backendEntry.getName(), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
@@ -208,9 +207,7 @@
 
 
     // Modify the backend to disable it.
-    mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-enabled", "false")));
+    mods = newArrayList(new Modification(REPLACE, Attributes.create("ds-cfg-enabled", "false")));
     modifyOperation = conn.processModify(backendEntry.getName(), mods);
     assertNull(DirectoryServer.getBackend(backendID));
     assertFalse(DirectoryServer.entryExists(baseDN));
@@ -434,8 +431,8 @@
 
 
     // Disable the intermediate (child) backend.  This should be allowed.
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE, Attributes.create("ds-cfg-enabled", "false")));
+    ArrayList<Modification> mods =
+        newArrayList(new Modification(REPLACE, Attributes.create("ds-cfg-enabled", "false")));
     ModifyOperation modifyOperation =
          conn.processModify(childBackendEntry.getName(), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
@@ -445,9 +442,7 @@
 
 
     // Re-enable the intermediate backend.
-    mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-enabled", "true")));
+    mods = newArrayList(new Modification(REPLACE, Attributes.create("ds-cfg-enabled", "true")));
     modifyOperation = conn.processModify(childBackendEntry.getName(), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java
index 2ee6222..2b5e61e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/BindOperationTestCase.java
@@ -32,7 +32,6 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.ModificationType;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.plugins.DisconnectClientPlugin;
@@ -48,8 +47,10 @@
 import org.testng.annotations.Test;
 
 import static org.assertj.core.api.Assertions.*;
+import static org.forgerock.opendj.ldap.ModificationType.*;
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
 import static org.opends.server.protocols.ldap.LDAPConstants.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.testng.Assert.*;
 
@@ -1665,9 +1666,7 @@
          InternalClientConnection.getRootConnection();
 
     String attr = "ds-cfg-bind-with-dn-requires-password";
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(attr, "false")));
+    ArrayList<Modification> mods = newArrayList(new Modification(REPLACE, Attributes.create(attr, "false")));
     ModifyOperation modifyOperation =
          conn.processModify(DN.valueOf("cn=config"), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
@@ -1677,9 +1676,7 @@
                                 ByteString.empty());
     assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
 
-    mods.clear();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(attr, "true")));
+    mods = newArrayList(new Modification(REPLACE, Attributes.create(attr, "true")));
     modifyOperation =  conn.processModify(DN.valueOf("cn=config"), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
   }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/CompareOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/CompareOperationTestCase.java
index 47bfff3..b1ad152 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/CompareOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/CompareOperationTestCase.java
@@ -44,6 +44,7 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 @SuppressWarnings("javadoc")
@@ -420,10 +421,8 @@
          InternalClientConnection.getRootConnection();
 
     LDAPFilter ldapFilter = LDAPFilter.decode("(preferredlanguage=ja)");
-    LDAPAssertionRequestControl assertControl =
-         new LDAPAssertionRequestControl(true, ldapFilter);
-    List<Control> controls = new ArrayList<>();
-    controls.add(assertControl);
+    Control assertControl = new LDAPAssertionRequestControl(true, ldapFilter);
+    List<Control> controls = newArrayList(assertControl);
 
     CompareOperationBasis compareOperation =
          new CompareOperationBasis(
@@ -450,10 +449,8 @@
          InternalClientConnection.getRootConnection();
 
     LDAPFilter ldapFilter = LDAPFilter.decode("(preferredlanguage=en)");
-    LDAPAssertionRequestControl assertControl =
-         new LDAPAssertionRequestControl(true, ldapFilter);
-    List<Control> controls = new ArrayList<>();
-    controls.add(assertControl);
+    Control assertControl = new LDAPAssertionRequestControl(true, ldapFilter);
+    List<Control> controls = newArrayList(assertControl);
 
     CompareOperationBasis compareOperation =
          new CompareOperationBasis(
@@ -475,11 +472,10 @@
   {
     InvocationCounterPlugin.resetAllCounters();
 
-    ProxiedAuthV1Control authV1Control =
+    Control authV1Control =
          new ProxiedAuthV1Control(ByteString.valueOf(
               "cn=Directory Manager,cn=Root DNs,cn=config"));
-    List<Control> controls = new ArrayList<>();
-    controls.add(authV1Control);
+    List<Control> controls = newArrayList(authV1Control);
 
     CompareOperationBasis compareOperation =
          new CompareOperationBasis(
@@ -505,10 +501,8 @@
 
     InvocationCounterPlugin.resetAllCounters();
 
-    ProxiedAuthV1Control authV1Control =
-         new ProxiedAuthV1Control(ByteString.valueOf("cn=nonexistent,o=test"));
-    List<Control> controls = new ArrayList<>();
-    controls.add(authV1Control);
+    Control authV1Control = new ProxiedAuthV1Control(ByteString.valueOf("cn=nonexistent,o=test"));
+    List<Control> controls = newArrayList(authV1Control);
 
     CompareOperationBasis compareOperation =
          new CompareOperationBasis(
@@ -531,11 +525,10 @@
   {
     InvocationCounterPlugin.resetAllCounters();
 
-    ProxiedAuthV2Control authV2Control =
+    Control authV2Control =
          new ProxiedAuthV2Control(ByteString.valueOf(
                   "dn:cn=Directory Manager,cn=Root DNs,cn=config"));
-    List<Control> controls = new ArrayList<>();
-    controls.add(authV2Control);
+    List<Control> controls = newArrayList(authV2Control);
 
     CompareOperationBasis compareOperation =
          new CompareOperationBasis(
@@ -559,10 +552,8 @@
   {
     InvocationCounterPlugin.resetAllCounters();
 
-    ProxiedAuthV2Control authV2Control = new ProxiedAuthV2Control(
-         ByteString.valueOf("dn:cn=nonexistent,o=test"));
-    List<Control> controls = new ArrayList<>();
-    controls.add(authV2Control);
+    Control authV2Control = new ProxiedAuthV2Control(ByteString.valueOf("dn:cn=nonexistent,o=test"));
+    List<Control> controls = newArrayList(authV2Control);
 
     CompareOperationBasis compareOperation =
          new CompareOperationBasis(
@@ -589,8 +580,7 @@
          new LDAPControl(ServerConstants.OID_PROXIED_AUTH_V2, false,
                      ByteString.empty());
 
-    List<Control> controls = new ArrayList<>();
-    controls.add(authV2Control);
+    List<Control> controls = newArrayList(authV2Control);
 
     CompareOperationBasis compareOperation =
          new CompareOperationBasis(
@@ -617,10 +607,8 @@
          InternalClientConnection.getRootConnection();
 
     LDAPFilter.decode("(preferredlanguage=ja)");
-    LDAPControl assertControl =
-         new LDAPControl("1.1.1.1.1.1", true);
-    List<Control> controls = new ArrayList<>();
-    controls.add(assertControl);
+    Control assertControl = new LDAPControl("1.1.1.1.1.1", true);
+    List<Control> controls = newArrayList(assertControl);
     CompareOperationBasis compareOperation =
          new CompareOperationBasis(
                               conn, InternalClientConnection.nextOperationID(),
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 ed21be3..eebbca9 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
@@ -55,6 +55,7 @@
 import static org.assertj.core.api.Assertions.*;
 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.*;
 import static org.testng.Assert.*;
 
@@ -642,13 +643,9 @@
   {
     // Add a matched values control.
     LDAPFilter ldapFilter = LDAPFilter.decode("(title=*director*)");
-    MatchedValuesFilter matchedValuesFilter =
-         MatchedValuesFilter.createFromLDAPFilter(ldapFilter);
-    ArrayList<MatchedValuesFilter> filters = new ArrayList<>();
-    filters.add(matchedValuesFilter);
-    MatchedValuesControl mvc = new MatchedValuesControl(true, filters);
-    ArrayList<Control> controls = new ArrayList<>();
-    controls.add(mvc);
+    ArrayList<MatchedValuesFilter> filters = newArrayList(MatchedValuesFilter.createFromLDAPFilter(ldapFilter));
+    Control mvc = new MatchedValuesControl(true, filters);
+    ArrayList<Control> controls = newArrayList(mvc);
 
     SearchRequestProtocolOp searchRequest =
          new SearchRequestProtocolOp(
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/AttributeValuePasswordValidatorTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/AttributeValuePasswordValidatorTestCase.java
index a6516ef..76fc157 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/AttributeValuePasswordValidatorTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/AttributeValuePasswordValidatorTestCase.java
@@ -26,36 +26,33 @@
  */
 package org.opends.server.extensions;
 
-
+import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.testng.Assert.*;
 
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import org.opends.server.TestCaseUtils;
 import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ModificationType;
+import org.opends.server.TestCaseUtils;
+import org.opends.server.admin.server.AdminTestCaseUtils;
 import org.opends.server.admin.std.meta.AttributeValuePasswordValidatorCfgDefn;
 import org.opends.server.admin.std.server.AttributeValuePasswordValidatorCfg;
-import org.opends.server.admin.server.AdminTestCaseUtils;
-import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.ModifyOperationBasis;
 import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.types.Attributes;
-import org.forgerock.opendj.ldap.ByteString;
 import org.opends.server.types.Control;
 import org.opends.server.types.DN;
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.Modification;
-import org.forgerock.opendj.ldap.ModificationType;
-
-import static org.testng.Assert.*;
-
-
+import org.opends.server.util.CollectionUtils;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
 
 /**
  * A set of test cases for the attribute value password validator.
@@ -438,12 +435,10 @@
     validator.initializePasswordValidator(configuration);
 
     ByteString pwOS = ByteString.valueOf(password);
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("userpassword", password)));
+    ArrayList<Modification> mods = CollectionUtils.newArrayList(
+        new Modification(ModificationType.REPLACE, Attributes.create("userpassword", password)));
 
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
+    InternalClientConnection conn = getRootConnection();
     ModifyOperationBasis modifyOperation =
          new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(),
                              new ArrayList<Control>(),
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/CharacterSetPasswordValidatorTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/CharacterSetPasswordValidatorTestCase.java
index b7612a1..659d842 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/CharacterSetPasswordValidatorTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/CharacterSetPasswordValidatorTestCase.java
@@ -26,8 +26,6 @@
  */
 package org.opends.server.extensions;
 
-
-
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -51,12 +49,11 @@
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.Modification;
-import org.forgerock.opendj.ldap.ModificationType;
 
+import static org.forgerock.opendj.ldap.ModificationType.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
-
-
 /**
  * A set of test cases for the character set password validator.
  */
@@ -994,9 +991,8 @@
     validator.initializePasswordValidator(configuration);
 
     ByteString pwOS = ByteString.valueOf(password);
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("userpassword", password)));
+    ArrayList<Modification> mods = newArrayList(
+        new Modification(REPLACE, Attributes.create("userpassword", password)));
 
     InternalClientConnection conn =
          InternalClientConnection.getRootConnection();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java
index 02e7e30..33c4eb7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java
@@ -27,8 +27,6 @@
  */
 package org.opends.server.extensions;
 
-
-
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -53,12 +51,11 @@
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.Modification;
-import org.forgerock.opendj.ldap.ModificationType;
 
+import static org.forgerock.opendj.ldap.ModificationType.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
-
-
 /**
  * A set of test cases for the dictionary password validator.
  */
@@ -675,9 +672,8 @@
     validator.initializePasswordValidator(configuration);
 
     ByteString pwOS = ByteString.valueOf(password);
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("userpassword", password)));
+    ArrayList<Modification> mods = newArrayList(
+        new Modification(REPLACE, Attributes.create("userpassword", password)));
 
     InternalClientConnection conn =
          InternalClientConnection.getRootConnection();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
index 81e76f2..a5dcc7b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
@@ -48,6 +48,7 @@
 
 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.*;
 import static org.testng.Assert.*;
 
@@ -494,8 +495,7 @@
       "o: test");
     entry.processVirtualAttributes();
 
-    LinkedList<ByteString> subAny = new LinkedList<>();
-    subAny.add(ByteString.valueOf("="));
+    LinkedList<ByteString> subAny = newLinkedList(ByteString.valueOf("="));
 
     assertEquals(provider.matchesSubstring(entry, getRule(provider), null, subAny, null),
                  ConditionResult.UNDEFINED);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java
index 2b2a498..1f01b07 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java
@@ -49,6 +49,7 @@
 import org.testng.annotations.Test;
 
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
@@ -804,8 +805,7 @@
 
     InternalClientConnection conn = getRootConnection();
     // Create a modification to change the map attribute from uid to cn.
-    ArrayList<ByteString> values = new ArrayList<>();
-    values.add(ByteString.valueOf("cn"));
+    ArrayList<ByteString> values = newArrayList(ByteString.valueOf("cn"));
 
     ArrayList<RawModification> mods = new ArrayList<>();
     mods.add(new LDAPModification(ModificationType.REPLACE,
@@ -883,8 +883,7 @@
 
     InternalClientConnection conn = getRootConnection();
     // Create a modification to set the map base DN to "dc=example,dc=com".
-    ArrayList<ByteString> values = new ArrayList<>();
-    values.add(ByteString.valueOf("dc=example,dc=com"));
+    ArrayList<ByteString> values = newArrayList(ByteString.valueOf("dc=example,dc=com"));
 
     ArrayList<RawModification> mods = new ArrayList<>();
     mods.add(new LDAPModification(ModificationType.REPLACE,
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java
index 1979765..ec871c0 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java
@@ -26,8 +26,6 @@
  */
 package org.opends.server.extensions;
 
-
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.net.Socket;
@@ -52,13 +50,19 @@
 import org.opends.server.tools.LDAPReader;
 import org.opends.server.tools.LDAPSearch;
 import org.opends.server.tools.LDAPWriter;
-import org.opends.server.types.*;
+import org.opends.server.types.Attributes;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
+import org.opends.server.types.InitializationException;
+import org.opends.server.types.Modification;
 import org.opends.server.util.Base64;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import static org.forgerock.opendj.ldap.ModificationType.*;
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
@@ -366,9 +370,7 @@
     InternalClientConnection conn = getRootConnection();
     String dnStr    = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config";
     String attrName = "ds-cfg-certificate-validation-policy";
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(attrName, "always")));
+    ArrayList<Modification> mods = newArrayList(new Modification(REPLACE, Attributes.create(attrName, "always")));
     ModifyOperation modifyOperation =
          conn.processModify(DN.valueOf(dnStr), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
@@ -562,9 +564,7 @@
     InternalClientConnection conn = getRootConnection();
     String dnStr    = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config";
     String attrName = "ds-cfg-certificate-validation-policy";
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(attrName, "always")));
+    ArrayList<Modification> mods = newArrayList(new Modification(REPLACE, Attributes.create(attrName, "always")));
     ModifyOperation modifyOperation =
          conn.processModify(DN.valueOf(dnStr), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
@@ -642,9 +642,7 @@
     InternalClientConnection conn = getRootConnection();
     String dnStr    = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config";
     String attrName = "ds-cfg-certificate-validation-policy";
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(attrName, "always")));
+    ArrayList<Modification> mods = newArrayList(new Modification(REPLACE, Attributes.create(attrName, "always")));
     ModifyOperation modifyOperation =
          conn.processModify(DN.valueOf(dnStr), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
index e1fbfc2..326da0a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
@@ -26,6 +26,9 @@
  */
 package org.opends.server.extensions;
 
+import static org.forgerock.opendj.ldap.ModificationType.*;
+import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 import java.io.File;
@@ -33,7 +36,6 @@
 import java.util.List;
 
 import org.forgerock.opendj.config.server.ConfigException;
-import org.forgerock.opendj.ldap.ModificationType;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.admin.server.AdminTestCaseUtils;
@@ -41,7 +43,6 @@
 import org.opends.server.admin.std.server.FingerprintCertificateMapperCfg;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.ModifyOperation;
-import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.tools.LDAPSearch;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.Attributes;
@@ -448,13 +449,9 @@
       Attributes.empty(DirectoryServer.getAttributeType(
                             "ds-cfg-fingerprint-attribute"));
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.DELETE, a));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
+    ArrayList<Modification> mods = newArrayList(new Modification(DELETE, a));
     ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
+         getRootConnection().processModify(DN.valueOf(mapperDN), mods);
     assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS);
   }
 
@@ -475,13 +472,9 @@
       Attributes.empty(DirectoryServer.getAttributeType(
                             "ds-cfg-fingerprint-algorithm"));
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.DELETE, a));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
+    ArrayList<Modification> mods = newArrayList(new Modification(DELETE, a));
     ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
+        getRootConnection().processModify(DN.valueOf(mapperDN), mods);
     assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS);
   }
 
@@ -543,15 +536,10 @@
     String externalDN = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config";
     String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-certificate-mapper",
-                                            mapperDN)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
+    ArrayList<Modification> mods = newArrayList(
+        new Modification(REPLACE, Attributes.create("ds-cfg-certificate-mapper", mapperDN)));
     ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(externalDN), mods);
+         getRootConnection().processModify(DN.valueOf(externalDN), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
   }
 
@@ -569,15 +557,10 @@
     String externalDN = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config";
     String mapperDN = "cn=Subject Equals DN,cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-certificate-mapper",
-                                            mapperDN)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
+    ArrayList<Modification> mods = newArrayList(
+        new Modification(REPLACE, Attributes.create("ds-cfg-certificate-mapper", mapperDN)));
     ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(externalDN), mods);
+         getRootConnection().processModify(DN.valueOf(externalDN), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
   }
 
@@ -597,15 +580,10 @@
   {
     String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-fingerprint-attribute",
-                       attrName)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
+    ArrayList<Modification> mods = newArrayList(
+        new Modification(REPLACE, Attributes.create("ds-cfg-fingerprint-attribute", attrName)));
     ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
+         getRootConnection().processModify(DN.valueOf(mapperDN), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
   }
 
@@ -624,15 +602,10 @@
   {
     String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-fingerprint-algorithm",
-                                    algorithm)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
+    ArrayList<Modification> mods = newArrayList(
+        new Modification(REPLACE, Attributes.create("ds-cfg-fingerprint-algorithm", algorithm)));
     ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
+         getRootConnection().processModify(DN.valueOf(mapperDN), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
   }
 
@@ -653,14 +626,10 @@
   {
     String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-user-base-dn", baseDNs)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
+    ArrayList<Modification> mods = newArrayList(
+        new Modification(REPLACE, Attributes.create("ds-cfg-user-base-dn", baseDNs)));
     ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
+         getRootConnection().processModify(DN.valueOf(mapperDN), mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
   }
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
index ecace3d..ab6a0a6 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
@@ -55,6 +55,7 @@
 
 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.testng.Assert.*;
 
 /**
@@ -485,8 +486,7 @@
 
     VirtualAttributeRule rule = buildRule(provider);
 
-    LinkedList<ByteString> subAny = new LinkedList<>();
-    subAny.add(ByteString.valueOf("="));
+    LinkedList<ByteString> subAny = newLinkedList(ByteString.valueOf("="));
 
     assertEquals(provider.matchesSubstring(entry, rule, null, subAny, null),
                  ConditionResult.UNDEFINED);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java
index c557898..860f07f 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java
@@ -26,8 +26,9 @@
  */
 package org.opends.server.extensions;
 
-
-
+import static org.forgerock.opendj.ldap.ModificationType.*;
+import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 import java.util.ArrayList;
@@ -35,27 +36,24 @@
 import java.util.List;
 
 import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.ldap.ByteString;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.admin.server.AdminTestCaseUtils;
 import org.opends.server.admin.std.meta.LengthBasedPasswordValidatorCfgDefn;
 import org.opends.server.admin.std.server.LengthBasedPasswordValidatorCfg;
-import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.ModifyOperationBasis;
-import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.types.Attributes;
-import org.forgerock.opendj.ldap.ByteString;
 import org.opends.server.types.Control;
 import org.opends.server.types.DN;
+import org.opends.server.types.DirectoryException;
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.Modification;
-import org.forgerock.opendj.ldap.ModificationType;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-
-
 /**
  * A set of test cases for the length-based password validator.
  */
@@ -362,16 +360,7 @@
       buffer.append('x');
       ByteString password = ByteString.valueOf(buffer.toString());
 
-      ArrayList<Modification> mods = new ArrayList<>();
-      mods.add(new Modification(ModificationType.REPLACE,
-          Attributes.create("userpassword", buffer.toString())));
-
-      InternalClientConnection conn =
-           InternalClientConnection.getRootConnection();
-      ModifyOperationBasis op =
-           new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(),
-                               InternalClientConnection.nextMessageID(), new ArrayList<Control>(),
-                               DN.valueOf("cn=uid=test.user,o=test"), mods);
+      ModifyOperationBasis op = newModifyOperation(buffer);
 
       LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
       assertTrue(validator.passwordIsAcceptable(password,
@@ -382,7 +371,16 @@
     validator.finalizePasswordValidator();
   }
 
+  private ModifyOperationBasis newModifyOperation(StringBuilder buffer) throws DirectoryException
+  {
+    ArrayList<Modification> mods = newArrayList(
+        new Modification(REPLACE, Attributes.create("userpassword", buffer.toString())));
 
+    ModifyOperationBasis op = new ModifyOperationBasis(
+        getRootConnection(), nextOperationID(), nextMessageID(),
+        new ArrayList<Control>(), DN.valueOf("cn=uid=test.user,o=test"), mods);
+    return op;
+  }
 
   /**
    * Tests the <CODE>passwordIsAcceptable</CODE> method with a constraint on the
@@ -434,16 +432,7 @@
       buffer.append('x');
       ByteString password = ByteString.valueOf(buffer.toString());
 
-      ArrayList<Modification> mods = new ArrayList<>();
-      mods.add(new Modification(ModificationType.REPLACE,
-          Attributes.create("userpassword", buffer.toString())));
-
-      InternalClientConnection conn =
-           InternalClientConnection.getRootConnection();
-      ModifyOperationBasis op =
-           new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(),
-                               InternalClientConnection.nextMessageID(), new ArrayList<Control>(),
-                               DN.valueOf("cn=uid=test.user,o=test"), mods);
+      ModifyOperationBasis op = newModifyOperation(buffer);
 
       LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
       assertEquals((buffer.length() >= 10),
@@ -508,16 +497,7 @@
       buffer.append('x');
       ByteString password = ByteString.valueOf(buffer.toString());
 
-      ArrayList<Modification> mods = new ArrayList<>();
-      mods.add(new Modification(ModificationType.REPLACE,
-          Attributes.create("userpassword", buffer.toString())));
-
-      InternalClientConnection conn =
-           InternalClientConnection.getRootConnection();
-      ModifyOperationBasis op =
-           new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(),
-                               InternalClientConnection.nextMessageID(), new ArrayList<Control>(),
-                               DN.valueOf("cn=uid=test.user,o=test"), mods);
+      ModifyOperationBasis op = newModifyOperation(buffer);
 
       LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
       assertEquals((buffer.length() <= 10),
@@ -582,16 +562,7 @@
       buffer.append('x');
       ByteString password = ByteString.valueOf(buffer.toString());
 
-      ArrayList<Modification> mods = new ArrayList<>();
-      mods.add(new Modification(ModificationType.REPLACE,
-          Attributes.create("userpassword", buffer.toString())));
-
-      InternalClientConnection conn =
-           InternalClientConnection.getRootConnection();
-      ModifyOperationBasis op =
-           new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(),
-                               InternalClientConnection.nextMessageID(), new ArrayList<Control>(),
-                               DN.valueOf("cn=uid=test.user,o=test"), mods);
+      ModifyOperationBasis op = newModifyOperation(buffer);
 
       LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
       assertEquals(((buffer.length() >= 6) && (buffer.length() <= 10)),
@@ -604,4 +575,3 @@
     validator.finalizePasswordValidator();
   }
 }
-
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/RepeatedCharactersPasswordValidatorTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/RepeatedCharactersPasswordValidatorTestCase.java
index 6eb4f68..94c3c22 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/RepeatedCharactersPasswordValidatorTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/RepeatedCharactersPasswordValidatorTestCase.java
@@ -26,35 +26,36 @@
  */
 package org.opends.server.extensions;
 
+import static org.forgerock.opendj.ldap.ModificationType.*;
+import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import org.opends.server.TestCaseUtils;
-import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.config.server.ConfigChangeResult;
+import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.opends.server.TestCaseUtils;
+import org.opends.server.admin.server.AdminTestCaseUtils;
 import org.opends.server.admin.std.meta.RepeatedCharactersPasswordValidatorCfgDefn;
 import org.opends.server.admin.std.server.RepeatedCharactersPasswordValidatorCfg;
-import org.opends.server.admin.server.AdminTestCaseUtils;
-import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.ModifyOperationBasis;
-import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.types.Attributes;
-import org.forgerock.opendj.config.server.ConfigChangeResult;
-import org.forgerock.opendj.ldap.ByteString;
 import org.opends.server.types.Control;
 import org.opends.server.types.DN;
+import org.opends.server.types.DirectoryException;
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.Modification;
-import org.forgerock.opendj.ldap.ModificationType;
-import org.forgerock.opendj.ldap.ResultCode;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
 
 /**
  * A set of test cases for the repeated characters password validator.
@@ -268,64 +269,9 @@
   public void testPasswordIsAcceptable2Consecutive()
          throws Exception
   {
-    TestCaseUtils.initializeTestBackend(true);
-    Entry userEntry = TestCaseUtils.makeEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: doesntmatter");
-
-    Entry validatorEntry = TestCaseUtils.makeEntry(
-         "dn: cn=Repeated Characters,cn=Password Validators,cn=config",
-         "objectClass: top",
-         "objectClass: ds-cfg-password-validator",
-         "objectClass: ds-cfg-repeated-characters-password-validator",
-         "cn: Repeated Characters",
-         "ds-cfg-java-class: org.opends.server.extensions." +
-              "RepeatedCharactersPasswordValidator",
-         "ds-cfg-enabled: true",
-         "ds-cfg-max-consecutive-length: 2",
-         "ds-cfg-case-sensitive-validation: false");
-
-    RepeatedCharactersPasswordValidatorCfg configuration =
-         AdminTestCaseUtils.getConfiguration(
-              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
-              validatorEntry);
-
-    RepeatedCharactersPasswordValidator validator =
-         new RepeatedCharactersPasswordValidator();
-    validator.initializePasswordValidator(configuration);
-
-    ByteString password = ByteString.valueOf("password");
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("userpassword", "password")));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperationBasis modifyOperation =
-         new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(),
-                             InternalClientConnection.nextMessageID(),
-                             new ArrayList<Control>(),
-                             DN.valueOf("uid=test.user,o=test"), mods);
-
-    LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
-    assertTrue(validator.passwordIsAcceptable(password,
-                              new HashSet<ByteString>(0), modifyOperation,
-                              userEntry, invalidReason),
-               invalidReason.toString());
-
-    validator.finalizePasswordValidator();
+    assertAcceptable("password", 2, false, true);
   }
 
-
-
   /**
    * Tests the {@code passwordIsAcceptable} method with a password that falls
    * outside of the constraints of the password validator.  Case-sensitivity
@@ -337,63 +283,9 @@
   public void testPasswordIsAcceptable3Consecutive()
          throws Exception
   {
-    TestCaseUtils.initializeTestBackend(true);
-    Entry userEntry = TestCaseUtils.makeEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: doesntmatter");
-
-    Entry validatorEntry = TestCaseUtils.makeEntry(
-         "dn: cn=Repeated Characters,cn=Password Validators,cn=config",
-         "objectClass: top",
-         "objectClass: ds-cfg-password-validator",
-         "objectClass: ds-cfg-repeated-characters-password-validator",
-         "cn: Repeated Characters",
-         "ds-cfg-java-class: org.opends.server.extensions." +
-              "RepeatedCharactersPasswordValidator",
-         "ds-cfg-enabled: true",
-         "ds-cfg-max-consecutive-length: 2",
-         "ds-cfg-case-sensitive-validation: false");
-
-    RepeatedCharactersPasswordValidatorCfg configuration =
-         AdminTestCaseUtils.getConfiguration(
-              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
-              validatorEntry);
-
-    RepeatedCharactersPasswordValidator validator =
-         new RepeatedCharactersPasswordValidator();
-    validator.initializePasswordValidator(configuration);
-
-    ByteString password = ByteString.valueOf("passsword");
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("userpassword", "passsword")));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperationBasis modifyOperation =
-         new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(),
-                             InternalClientConnection.nextMessageID(),
-                             new ArrayList<Control>(),
-                             DN.valueOf("uid=test.user,o=test"), mods);
-
-    LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
-    assertFalse(validator.passwordIsAcceptable(password,
-                               new HashSet<ByteString>(0), modifyOperation,
-                               userEntry, invalidReason));
-
-    validator.finalizePasswordValidator();
+    assertAcceptable("passsword", 2, false, false);
   }
 
-
-
   /**
    * Tests the {@code passwordIsAcceptable} method with a password that falls
    * within the constraints of the password validator only because it is
@@ -405,60 +297,7 @@
   public void testPasswordIsAcceptableCaseSensitive()
          throws Exception
   {
-    TestCaseUtils.initializeTestBackend(true);
-    Entry userEntry = TestCaseUtils.makeEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: doesntmatter");
-
-    Entry validatorEntry = TestCaseUtils.makeEntry(
-         "dn: cn=Repeated Characters,cn=Password Validators,cn=config",
-         "objectClass: top",
-         "objectClass: ds-cfg-password-validator",
-         "objectClass: ds-cfg-repeated-characters-password-validator",
-         "cn: Repeated Characters",
-         "ds-cfg-java-class: org.opends.server.extensions." +
-              "RepeatedCharactersPasswordValidator",
-         "ds-cfg-enabled: true",
-         "ds-cfg-max-consecutive-length: 2",
-         "ds-cfg-case-sensitive-validation: true");
-
-    RepeatedCharactersPasswordValidatorCfg configuration =
-         AdminTestCaseUtils.getConfiguration(
-              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
-              validatorEntry);
-
-    RepeatedCharactersPasswordValidator validator =
-         new RepeatedCharactersPasswordValidator();
-    validator.initializePasswordValidator(configuration);
-
-    ByteString password = ByteString.valueOf("passSword");
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("userpassword", "passSword")));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperationBasis modifyOperation =
-         new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(),
-                             InternalClientConnection.nextMessageID(),
-                             new ArrayList<Control>(),
-                             DN.valueOf("uid=test.user,o=test"), mods);
-
-    LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
-    assertTrue(validator.passwordIsAcceptable(password,
-                              new HashSet<ByteString>(0), modifyOperation,
-                              userEntry, invalidReason),
-               invalidReason.toString());
-
-    validator.finalizePasswordValidator();
+    assertAcceptable("passSword", 2, true, true);
   }
 
 
@@ -474,59 +313,7 @@
   public void testPasswordIsAcceptableCaseInsensitive()
          throws Exception
   {
-    TestCaseUtils.initializeTestBackend(true);
-    Entry userEntry = TestCaseUtils.makeEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: doesntmatter");
-
-    Entry validatorEntry = TestCaseUtils.makeEntry(
-         "dn: cn=Repeated Characters,cn=Password Validators,cn=config",
-         "objectClass: top",
-         "objectClass: ds-cfg-password-validator",
-         "objectClass: ds-cfg-repeated-characters-password-validator",
-         "cn: Repeated Characters",
-         "ds-cfg-java-class: org.opends.server.extensions." +
-              "RepeatedCharactersPasswordValidator",
-         "ds-cfg-enabled: true",
-         "ds-cfg-max-consecutive-length: 2",
-         "ds-cfg-case-sensitive-validation: false");
-
-    RepeatedCharactersPasswordValidatorCfg configuration =
-         AdminTestCaseUtils.getConfiguration(
-              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
-              validatorEntry);
-
-    RepeatedCharactersPasswordValidator validator =
-         new RepeatedCharactersPasswordValidator();
-    validator.initializePasswordValidator(configuration);
-
-    ByteString password = ByteString.valueOf("passSword");
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("userpassword", "passSword")));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperationBasis modifyOperation =
-         new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(),
-                             InternalClientConnection.nextMessageID(),
-                             new ArrayList<Control>(),
-                             DN.valueOf("uid=test.user,o=test"), mods);
-
-    LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
-    assertFalse(validator.passwordIsAcceptable(password,
-                               new HashSet<ByteString>(0), modifyOperation,
-                               userEntry, invalidReason));
-
-    validator.finalizePasswordValidator();
+    assertAcceptable("passSword", 2, false, false);
   }
 
 
@@ -541,64 +328,9 @@
   public void testPasswordIsAcceptableUnlimitedRepeats()
          throws Exception
   {
-    TestCaseUtils.initializeTestBackend(true);
-    Entry userEntry = TestCaseUtils.makeEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: doesntmatter");
-
-    Entry validatorEntry = TestCaseUtils.makeEntry(
-         "dn: cn=Repeated Characters,cn=Password Validators,cn=config",
-         "objectClass: top",
-         "objectClass: ds-cfg-password-validator",
-         "objectClass: ds-cfg-repeated-characters-password-validator",
-         "cn: Repeated Characters",
-         "ds-cfg-java-class: org.opends.server.extensions." +
-              "RepeatedCharactersPasswordValidator",
-         "ds-cfg-enabled: true",
-         "ds-cfg-max-consecutive-length: 0",
-         "ds-cfg-case-sensitive-validation: true");
-
-    RepeatedCharactersPasswordValidatorCfg configuration =
-         AdminTestCaseUtils.getConfiguration(
-              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
-              validatorEntry);
-
-    RepeatedCharactersPasswordValidator validator =
-         new RepeatedCharactersPasswordValidator();
-    validator.initializePasswordValidator(configuration);
-
-    ByteString password = ByteString.valueOf("aaaaaaaa");
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("userpassword", "aaaaaaaa")));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperationBasis modifyOperation =
-         new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(),
-                             InternalClientConnection.nextMessageID(),
-                             new ArrayList<Control>(),
-                             DN.valueOf("uid=test.user,o=test"), mods);
-
-    LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
-    assertTrue(validator.passwordIsAcceptable(password,
-                              new HashSet<ByteString>(0), modifyOperation,
-                              userEntry, invalidReason),
-               invalidReason.toString());
-
-    validator.finalizePasswordValidator();
+    assertAcceptable("aaaaaaaa", 0, true, true);
   }
 
-
-
   /**
    * Tests the ability of the password validator to change its behavior when
    * the configuration is updated.
@@ -643,24 +375,8 @@
          new RepeatedCharactersPasswordValidator();
     validator.initializePasswordValidator(configuration);
 
-    ByteString password = ByteString.valueOf("aaaaaaaa");
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("userpassword", "aaaaaaaa")));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperationBasis modifyOperation =
-         new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(),
-                             InternalClientConnection.nextMessageID(),
-                             new ArrayList<Control>(),
-                             DN.valueOf("uid=test.user,o=test"), mods);
-
-    LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
-    assertTrue(validator.passwordIsAcceptable(password,
-                              new HashSet<ByteString>(0), modifyOperation,
-                              userEntry, invalidReason),
-               invalidReason.toString());
+    String value = "aaaaaaaa";
+    assertAcceptable(validator, value, userEntry, true);
 
     Entry updatedValidatorEntry = TestCaseUtils.makeEntry(
          "dn: cn=Repeated Characters,cn=Password Validators,cn=config",
@@ -688,11 +404,68 @@
          validator.applyConfigurationChange(updatedConfiguration);
     assertEquals(changeResult.getResultCode(), ResultCode.SUCCESS);
 
-    assertFalse(validator.passwordIsAcceptable(password,
-                               new HashSet<ByteString>(0), modifyOperation,
-                               userEntry, invalidReason));
+    assertAcceptable(validator, value, userEntry, false);
 
     validator.finalizePasswordValidator();
   }
-}
 
+  private void assertAcceptable(String value, int maxConsecutiveLength, boolean caseSensitiveValidation,
+      boolean expectedResult) throws Exception, ConfigException, DirectoryException
+  {
+    TestCaseUtils.initializeTestBackend(true);
+    Entry userEntry = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: doesntmatter");
+
+    Entry validatorEntry = TestCaseUtils.makeEntry(
+         "dn: cn=Repeated Characters,cn=Password Validators,cn=config",
+         "objectClass: top",
+         "objectClass: ds-cfg-password-validator",
+         "objectClass: ds-cfg-repeated-characters-password-validator",
+         "cn: Repeated Characters",
+         "ds-cfg-java-class: org.opends.server.extensions.RepeatedCharactersPasswordValidator",
+         "ds-cfg-enabled: true",
+         "ds-cfg-max-consecutive-length: " + maxConsecutiveLength,
+         "ds-cfg-case-sensitive-validation: " + caseSensitiveValidation);
+
+    RepeatedCharactersPasswordValidatorCfgDefn defn = RepeatedCharactersPasswordValidatorCfgDefn.getInstance();
+    RepeatedCharactersPasswordValidatorCfg configuration = AdminTestCaseUtils.getConfiguration(defn, validatorEntry);
+
+    RepeatedCharactersPasswordValidator validator = new RepeatedCharactersPasswordValidator();
+    validator.initializePasswordValidator(configuration);
+
+    assertAcceptable(validator, value, userEntry, expectedResult);
+
+    validator.finalizePasswordValidator();
+  }
+
+  private void assertAcceptable(RepeatedCharactersPasswordValidator validator, String value, Entry userEntry,
+      boolean expectedResult) throws DirectoryException
+  {
+    ByteString password = ByteString.valueOf(value);
+    ModifyOperationBasis modifyOperation = replaceUserPasswordAttribute(value);
+
+    LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
+    boolean acceptable =
+        validator.passwordIsAcceptable(password, new HashSet<ByteString>(0), modifyOperation, userEntry, invalidReason);
+    assertEquals(acceptable, expectedResult, invalidReason.toString());
+  }
+
+  private ModifyOperationBasis replaceUserPasswordAttribute(String newValue) throws DirectoryException
+  {
+    ArrayList<Modification> mods = newArrayList(
+        new Modification(REPLACE, Attributes.create("userpassword", newValue)));
+
+    return new ModifyOperationBasis(
+        getRootConnection(), nextOperationID(), nextMessageID(),
+        new ArrayList<Control>(), DN.valueOf("uid=test.user,o=test"), mods);
+  }
+}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java
index 685b39c..01ecaee 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java
@@ -26,8 +26,6 @@
  */
 package org.opends.server.extensions;
 
-
-
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -46,14 +44,14 @@
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.Modification;
-import org.forgerock.opendj.ldap.ModificationType;
+
+import static org.forgerock.opendj.ldap.ModificationType.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 import org.opends.server.admin.std.meta.SimilarityBasedPasswordValidatorCfgDefn;
 import org.opends.server.admin.std.server.SimilarityBasedPasswordValidatorCfg;
 import org.opends.server.admin.server.AdminTestCaseUtils;
 
-
-
 /**
  * A set of test cases for the Similarity-Based Password Reject.
  */
@@ -283,9 +281,8 @@
       buffer.append('x');
       ByteString password = ByteString.valueOf(buffer.toString());
 
-      ArrayList<Modification> mods = new ArrayList<>();
-      mods.add(new Modification(ModificationType.REPLACE,
-          Attributes.create("userpassword", buffer.toString())));
+      ArrayList<Modification> mods = newArrayList(
+          new Modification(REPLACE, Attributes.create("userpassword", buffer.toString())));
 
       InternalClientConnection conn =
            InternalClientConnection.getRootConnection();
@@ -358,9 +355,8 @@
       buffer.append('x');
       ByteString password = ByteString.valueOf(buffer.toString());
 
-      ArrayList<Modification> mods = new ArrayList<>();
-      mods.add(new Modification(ModificationType.REPLACE,
-          Attributes.create("userpassword", buffer.toString())));
+      ArrayList<Modification> mods = newArrayList(
+          new Modification(REPLACE, Attributes.create("userpassword", buffer.toString())));
 
       InternalClientConnection conn =
            InternalClientConnection.getRootConnection();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
index 452f0af..3dae3ed 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
@@ -27,6 +27,9 @@
  */
 package org.opends.server.extensions;
 
+import static org.forgerock.opendj.ldap.ModificationType.*;
+import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 import java.io.File;
@@ -43,13 +46,13 @@
 import org.opends.server.admin.std.server.SubjectAttributeToUserAttributeCertificateMapperCfg;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.ModifyOperation;
-import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.tools.LDAPSearch;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.AttributeBuilder;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.Attributes;
 import org.opends.server.types.DN;
+import org.opends.server.types.DirectoryException;
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.Modification;
@@ -735,18 +738,13 @@
       Attributes.empty(DirectoryServer.getAttributeType(
                             "ds-cfg-subject-attribute-mapping"));
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.DELETE, a));
+    ArrayList<Modification> mods = newArrayList(
+        new Modification(ModificationType.DELETE, a));
 
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
+    ModifyOperation modifyOperation = getRootConnection().processModify(DN.valueOf(mapperDN), mods);
     assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS);
   }
 
-
-
   /**
    * Tests to ensure that an attempt to set an attribute mapping with no colon
    * will fail.
@@ -864,19 +862,10 @@
     String mapperDN = "cn=Subject Attribute to User Attribute," +
                       "cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-certificate-mapper", mapperDN)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(externalDN), mods);
-    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+    Attribute attr = Attributes.create("ds-cfg-certificate-mapper", mapperDN);
+    assertModifyReplaceIsSuccess(externalDN, attr);
   }
 
-
-
   /**
    * Alters the configuration of the SASL EXTERNAL mechanism handler so that it
    * uses the Subject Equals DN certificate mapper.
@@ -889,19 +878,10 @@
     String externalDN = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config";
     String mapperDN = "cn=Subject Equals DN,cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-certificate-mapper", mapperDN)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(externalDN), mods);
-    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+    Attribute attr = Attributes.create("ds-cfg-certificate-mapper", mapperDN);
+    assertModifyReplaceIsSuccess(externalDN, attr);
   }
 
-
-
   /**
    * Alters the configuration of the Subject Attribute to User Attribute
    * certificate mapper so that it will use the specified set of mappings.
@@ -916,15 +896,8 @@
     String mapperDN = "cn=Subject Attribute to User Attribute," +
                       "cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-subject-attribute-mapping", mappings)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
-    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+    Attribute attr = Attributes.create("ds-cfg-subject-attribute-mapping", mappings);
+    assertModifyReplaceIsSuccess(mapperDN, attr);
   }
 
 
@@ -945,23 +918,14 @@
     String mapperDN = "cn=Subject Attribute to User Attribute," +
                       "cn=Certificate Mappers,cn=config";
 
-    AttributeType attrType =
-         DirectoryServer.getAttributeType("ds-cfg-user-base-dn");
-
+    AttributeType attrType = DirectoryServer.getAttributeType("ds-cfg-user-base-dn");
     AttributeBuilder builder = new AttributeBuilder(attrType);
     if (baseDNs != null)
     {
       builder.addAllStrings(Arrays.asList(baseDNs));
     }
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE, builder.toAttribute()));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
-    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+    assertModifyReplaceIsSuccess(mapperDN, builder.toAttribute());
   }
 
   /**
@@ -1022,5 +986,11 @@
       disableMapper();
     }
   }
-}
 
+  private void assertModifyReplaceIsSuccess(String dn, Attribute replaceAttr) throws DirectoryException
+  {
+    ArrayList<Modification> mods = newArrayList(new Modification(REPLACE, replaceAttr));
+    ModifyOperation modifyOperation = getRootConnection().processModify(DN.valueOf(dn), mods);
+    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+  }
+}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
index 69f2458..6230a7a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
@@ -26,6 +26,9 @@
  */
 package org.opends.server.extensions;
 
+import static org.forgerock.opendj.ldap.ModificationType.*;
+import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 import java.io.File;
@@ -42,13 +45,13 @@
 import org.opends.server.admin.std.server.SubjectDNToUserAttributeCertificateMapperCfg;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.ModifyOperation;
-import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.tools.LDAPSearch;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.AttributeBuilder;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.Attributes;
 import org.opends.server.types.DN;
+import org.opends.server.types.DirectoryException;
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.Modification;
@@ -542,28 +545,19 @@
   public void testRemoveSubjectAttribute()
          throws Exception
   {
-    String mapperDN =
-         "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config";
+    String mapperDN = "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config";
+    Attribute a = Attributes.empty(DirectoryServer.getAttributeType("ds-cfg-subject-attribute"));
 
-    Attribute a =
-      Attributes.empty(DirectoryServer.getAttributeType(
-                            "ds-cfg-subject-attribute"));
-
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.DELETE, a));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
+    ArrayList<Modification> mods = newArrayList(new Modification(ModificationType.DELETE, a));
     ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
+        getRootConnection().processModify(DN.valueOf(mapperDN), mods);
     assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS);
   }
 
 
 
   /**
-   * Tests to ensure that an attmept to set an undefined subject attribute will
-   * fail.
+   * Tests to ensure that an attempt to set an undefined subject attribute will fail.
    *
    * @throws  Exception  If an unexpected problem occurs.
    */
@@ -577,7 +571,7 @@
 
 
   /**
-   * Tests to ensure that an attmept to set an invalid base DN will fail.
+   * Tests to ensure that an attempt to set an invalid base DN will fail.
    *
    * @throws  Exception  If an unexpected problem occurs.
    */
@@ -603,15 +597,8 @@
     String mapperDN =
          "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-certificate-mapper", mapperDN)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(externalDN), mods);
-    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+    Attribute attr = Attributes.create("ds-cfg-certificate-mapper", mapperDN);
+    assertModifyReplaceIsSuccess(externalDN, attr);
   }
 
 
@@ -628,15 +615,8 @@
     String externalDN = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config";
     String mapperDN = "cn=Subject Equals DN,cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-certificate-mapper", mapperDN)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(externalDN), mods);
-    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+    Attribute attr = Attributes.create("ds-cfg-certificate-mapper", mapperDN);
+    assertModifyReplaceIsSuccess(externalDN, attr);
   }
 
 
@@ -656,15 +636,8 @@
     String mapperDN =
          "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config";
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create("ds-cfg-subject-attribute", attrName)));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
-    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+    Attribute attr = Attributes.create("ds-cfg-subject-attribute", attrName);
+    assertModifyReplaceIsSuccess(mapperDN, attr);
   }
 
 
@@ -692,15 +665,7 @@
       builder.addAllStrings(Arrays.asList(baseDNs));
     }
 
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-                              builder.toAttribute()));
-
-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
-    ModifyOperation modifyOperation =
-         conn.processModify(DN.valueOf(mapperDN), mods);
-    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+    assertModifyReplaceIsSuccess(mapperDN, builder.toAttribute());
   }
 
   /**
@@ -762,5 +727,11 @@
       disableMapper();
     }
   }
-}
 
+  private void assertModifyReplaceIsSuccess(String mapperDN, Attribute attr) throws DirectoryException
+  {
+    ArrayList<Modification> mods = newArrayList(new Modification(REPLACE, attr));
+    ModifyOperation modifyOperation = getRootConnection().processModify(DN.valueOf(mapperDN), mods);
+    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
+  }
+}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/TraditionalWorkQueueTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/TraditionalWorkQueueTestCase.java
index 504c5e4..179951a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/TraditionalWorkQueueTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/TraditionalWorkQueueTestCase.java
@@ -26,11 +26,8 @@
  */
 package org.opends.server.extensions;
 
-
-
 import java.util.ArrayList;
 
-import org.forgerock.opendj.ldap.ModificationType;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.SearchScope;
 import org.opends.server.TestCaseUtils;
@@ -49,8 +46,10 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import static org.forgerock.opendj.ldap.ModificationType.*;
 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.testng.Assert.*;
 
 /**
@@ -97,17 +96,13 @@
   {
     DN     dn   = DN.valueOf("cn=Work Queue,cn=config");
     String attr = "ds-cfg-num-worker-threads";
-    ArrayList<Modification> mods = new ArrayList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(attr, "30")));
+    ArrayList<Modification> mods = newArrayList(new Modification(REPLACE, Attributes.create(attr, "30")));
 
     InternalClientConnection conn = getRootConnection();
     ModifyOperation modifyOperation = conn.processModify(dn, mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
 
-    mods.clear();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(attr, "24")));
+    mods = newArrayList(new Modification(REPLACE, Attributes.create(attr, "24")));
     modifyOperation = conn.processModify(dn, mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java
index 94d8031..09ce148 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java
@@ -48,6 +48,7 @@
 
 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.testng.Assert.*;
 
 /**
@@ -777,10 +778,8 @@
     ByteString v = ByteString.valueOf(u4.toString());
     assertTrue(a.contains(v));
 
-    LinkedList<Modification> mods = new LinkedList<>();
-    mods.add(new Modification(ModificationType.ADD,
-        Attributes.create("memberurl",
-                       "ldap:///o=test??sub?(objectClass=person)")));
+    LinkedList<Modification> mods = newLinkedList(new Modification(ModificationType.ADD,
+        Attributes.create("memberurl", "ldap:///o=test??sub?(objectClass=person)")));
     ModifyOperation modifyOperation = getRootConnection().processModify(d1, mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
 
@@ -818,8 +817,7 @@
 
     InternalClientConnection conn = getRootConnection();
 
-    LinkedList<Modification> mods = new LinkedList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
+    LinkedList<Modification> mods = newLinkedList(new Modification(ModificationType.REPLACE,
         Attributes.create("ds-cfg-allow-retrieving-membership", "false")));
     DN definitionDN =
          DN.valueOf("cn=Virtual Static member,cn=Virtual Attributes,cn=config");
@@ -838,8 +836,7 @@
     assertTrue(a.contains(v));
 
 
-    mods = new LinkedList<>();
-    mods.add(new Modification(ModificationType.REPLACE,
+    mods = newLinkedList(new Modification(ModificationType.REPLACE,
         Attributes.create("ds-cfg-allow-retrieving-membership", "true")));
     modifyOperation = conn.processModify(definitionDN, mods);
     assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java
index 52b5715..ad43949 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java
@@ -61,6 +61,7 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import static org.forgerock.opendj.ldap.ModificationType.*;
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
 import static org.opends.server.protocols.internal.Requests.*;
 import static org.opends.server.util.CollectionUtils.*;
@@ -1030,8 +1031,8 @@
    */
   private ModifyOperation
   addAttrEntry(DN dn, String attrName, String... attrValStrings) {
-    LinkedList<Modification> mods = new LinkedList<>();
-    mods.add(new Modification(ModificationType.ADD, Attributes.create(attrName, attrValStrings)));
+    LinkedList<Modification> mods = newLinkedList(
+        new Modification(ADD, Attributes.create(attrName, attrValStrings)));
     return getRootConnection().processModify(dn, mods);
   }
 
@@ -1043,8 +1044,8 @@
    * @param attrValStrings The values to replace in the the entry.
    */
   private ModifyOperation  replaceAttrEntry(DN dn, String attrName, String... attrValStrings) {
-    LinkedList<Modification> mods = new LinkedList<>();
-    mods.add(new Modification(ModificationType.REPLACE, Attributes.create(attrName, attrValStrings)));
+    LinkedList<Modification> mods = newLinkedList(
+        new Modification(REPLACE, Attributes.create(attrName, attrValStrings)));
     return getRootConnection().processModify(dn, mods);
   }
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java
index 21b422c..e074e8e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/SambaPasswordPluginTestCase.java
@@ -26,6 +26,8 @@
  */
 package org.opends.server.plugins;
 
+import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.opends.server.util.StaticUtils.*;
 import static org.testng.Assert.*;
 
@@ -139,16 +141,13 @@
      * Samba administrative user needs a permission to manipulate user accounts.
      * Hence, we add a very permissive ACI.
      */
-    InternalClientConnection conn = InternalClientConnection.getRootConnection();
-    LinkedList<Modification> mods = new LinkedList<>();
-
-    mods.add(new Modification(ModificationType.ADD, Attributes.create("aci",
+    LinkedList<Modification> mods =
+        newLinkedList(new Modification(ModificationType.ADD, Attributes.create("aci",
         "(target=\"ldap:///uid=*,o=test\")(targetattr=\"*\")"
             + "(version 3.0; acl \"Samba admin\"; allow (all) "
             + "userdn=\"ldap:///cn=samba admin,o=test\";)")));
 
-    ModifyOperation modOp = conn.processModify(DN.valueOf("o=test"), mods);
-
+    ModifyOperation modOp = getRootConnection().processModify(DN.valueOf("o=test"), mods);
     assertEquals(modOp.getResultCode(), ResultCode.SUCCESS);
   }
 
@@ -220,15 +219,10 @@
     TestCaseUtils.addEntry(testEntry);
 
     // Perform the modify operation
-    InternalClientConnection conn = InternalClientConnection.getRootConnection();
+    LinkedList<Modification> mods = newLinkedList(
+        new Modification(ModificationType.REPLACE, Attributes.create("userPassword", "password")));
 
-    LinkedList<Modification> mods = new LinkedList<>();
-
-    mods.add(new Modification(ModificationType.REPLACE, Attributes.create(
-        "userPassword", "password")));
-
-    ModifyOperation modOp = conn.processModify(testEntry.getName(), mods);
-
+    ModifyOperation modOp = getRootConnection().processModify(testEntry.getName(), mods);
     assertEquals(modOp.getResultCode(), ResultCode.SUCCESS);
 
     // Verification of the change
@@ -299,13 +293,9 @@
 
     InternalClientConnection conn = new InternalClientConnection(authInfo);
 
-    LinkedList<Modification> mods = new LinkedList<>();
-
-    mods.add(new Modification(ModificationType.REPLACE, Attributes.create(
-        "userPassword", "password")));
-
+    LinkedList<Modification> mods = newLinkedList(
+        new Modification(ModificationType.REPLACE, Attributes.create("userPassword", "password")));
     ModifyOperation modOp = conn.processModify(testEntry.getName(), mods);
-
     assertEquals(modOp.getResultCode(), ResultCode.SUCCESS);
 
     // Verification of the result
@@ -346,27 +336,18 @@
 
     InternalClientConnection conn = new InternalClientConnection(authInfo);
 
-    LinkedList<Modification> mods = new LinkedList<>();
-
-    mods.add(new Modification(ModificationType.REPLACE, Attributes.create(
-        "userPassword", "password1")));
+    LinkedList<Modification> mods = newLinkedList(
+        new Modification(ModificationType.REPLACE, Attributes.create("userPassword", "password1")));
 
     ModifyOperation modOp = conn.processModify(testEntry.getName(), mods);
-
     assertEquals(modOp.getResultCode(), ResultCode.SUCCESS);
 
     // Verification of the result
 
     Entry entry = DirectoryServer.getEntry(testEntry.getName());
     assertNotNull(entry);
-
-    List<Attribute> sambaAttribute = entry.getAttribute("sambantpassword");
-
-    assertNull(sambaAttribute);
-
-    sambaAttribute = entry.getAttribute("sambalmpassword");
-
-    assertNull(sambaAttribute);
+    assertNull(entry.getAttribute("sambantpassword"));
+    assertNull(entry.getAttribute("sambalmpassword"));
 
     TestCaseUtils.deleteEntry(entry);
   }
@@ -393,21 +374,12 @@
     TestCaseUtils.addEntry(testEntry);
 
     // Perform the modify operation
-    InternalClientConnection conn = InternalClientConnection
-        .getRootConnection();
-
     LinkedList<Modification> mods = new LinkedList<>();
+    mods.add(new Modification(ModificationType.ADD, Attributes.create("userPassword", "password1")));
+    mods.add(new Modification(ModificationType.ADD, Attributes.create("userPassword", "password2")));
+    mods.add(new Modification(ModificationType.ADD, Attributes.create("userPassword", "password3")));
 
-    mods.add(new Modification(ModificationType.ADD, Attributes.create(
-        "userPassword", "password1")));
-    mods.add(new Modification(ModificationType.ADD, Attributes.create(
-        "userPassword", "password2")));
-
-    mods.add(new Modification(ModificationType.ADD, Attributes.create(
-        "userPassword", "password3")));
-
-    ModifyOperation modOp = conn.processModify(testEntry.getName(), mods);
-
+    ModifyOperation modOp = getRootConnection().processModify(testEntry.getName(), mods);
     assertEquals(modOp.getResultCode(), ResultCode.SUCCESS);
 
     // Verification of the result
@@ -705,29 +677,15 @@
       InternalClientConnection conn = InternalClientConnection
           .getRootConnection();
 
-      LinkedList<Modification> mods = new LinkedList<>();
-
-      mods.add(new Modification(ModificationType.REPLACE, Attributes.create(
-          "userPassword", "password")));
+      LinkedList<Modification> mods =
+          newLinkedList(new Modification(ModificationType.REPLACE, Attributes.create("userPassword", "password")));
 
       ModifyOperation modOp = conn.processModify(testEntry.getName(), mods);
-
       assertEquals(modOp.getResultCode(), ResultCode.SUCCESS);
 
       Attribute sambaPwdLastSetAttr =
         Attributes.create("sambapwdlastset", String.valueOf(1339012789L));
-      boolean attrPresent = false;
-
-      for (Modification mod : modOp.getModifications())
-      {
-        if (mod.getAttribute().equals(sambaPwdLastSetAttr))
-        {
-          attrPresent = true;
-          break;
-        }
-      }
-
-      assertTrue(attrPresent);
+      assertTrue(containsAttribute(modOp, sambaPwdLastSetAttr));
 
       TestCaseUtils.deleteEntry(testEntry);
     }
@@ -737,6 +695,18 @@
     }
   }
 
+  private boolean containsAttribute(ModifyOperation modOp, Attribute attr)
+  {
+    for (Modification mod : modOp.getModifications())
+    {
+      if (mod.getAttribute().equals(attr))
+      {
+        return true;
+      }
+    }
+    return false;
+  }
+
   /**
    * Test if the plugin properly updates the 'sambaPwdLastSet' attribute when
    * the password is changed through the PMEO.
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
index 7264241..b22b130 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
@@ -46,6 +46,7 @@
 import org.testng.annotations.*;
 
 import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
@@ -738,8 +739,8 @@
   }
 
   private void replaceAttrInEntry(DN dn, String attrName, String... attrValStrings) {
-    LinkedList<Modification> mods = new LinkedList<>();
-    mods.add(new Modification(ModificationType.REPLACE, Attributes.create(attrName, attrValStrings)));
+    LinkedList<Modification> mods = newLinkedList(
+        new Modification(ModificationType.REPLACE, Attributes.create(attrName, attrValStrings)));
     getRootConnection().processModify(dn, mods);
   }
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/StressTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/StressTest.java
index 468de32..0f20dbc 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/StressTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/StressTest.java
@@ -26,16 +26,20 @@
  */
 package org.opends.server.replication;
 
+import static org.opends.server.TestCaseUtils.*;
+import static org.testng.Assert.*;
+
 import java.util.LinkedList;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
 import java.util.List;
 
 import org.assertj.core.api.Assertions;
 import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.admin.std.server.MonitorProviderCfg;
 import org.opends.server.api.MonitorProvider;
-import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.AddOperation;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.ModifyOperation;
@@ -44,13 +48,9 @@
 import org.opends.server.replication.protocol.ReplicationMsg;
 import org.opends.server.replication.service.ReplicationBroker;
 import org.opends.server.types.*;
-import org.forgerock.opendj.ldap.ResultCode;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import static org.opends.server.TestCaseUtils.*;
-import static org.testng.Assert.*;
-
 /**
  * Stress test for the synchronization code using the ReplicationBroker API.
  */
@@ -318,19 +318,10 @@
     @Override
     public List<Attribute> getMonitorData()
     {
-      Attribute attr;
-      if (reader == null)
-      {
-        attr = Attributes.create("received-messages", "not yet started");
-      }
-      else
-      {
-        attr = Attributes.create("received-messages", String.valueOf(reader.getCurrentCount()));
-      }
+      String value = reader != null ? String.valueOf(reader.getCurrentCount()) : "not yet started";
       List<Attribute> list = new LinkedList<>();
-      list.add(attr);
-      attr = Attributes.create("base-dn", "ou=People," + TEST_ROOT_DN_STRING);
-      list.add(attr);
+      list.add(Attributes.create("received-messages", value));
+      list.add(Attributes.create("base-dn", "ou=People," + TEST_ROOT_DN_STRING));
       return list;
     }
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
index 9cc0d5a..7725653 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
@@ -49,8 +49,11 @@
 import org.opends.server.workflowelement.localbackend.LocalBackendModifyOperation;
 import org.testng.annotations.Test;
 
+import static org.assertj.core.api.Assertions.*;
 import static org.opends.server.TestCaseUtils.*;
+import static org.opends.server.protocols.internal.InternalClientConnection.*;
 import static org.opends.server.replication.protocol.OperationContext.*;
+import static org.opends.server.util.CollectionUtils.*;
 import static org.testng.Assert.*;
 
 /**
@@ -903,17 +906,10 @@
     attr = Attributes.create(DESCRIPTION, "Init Value");
     Modification mod2 = new Modification(ModificationType.ADD, attr);
 
-    List<Modification> mods = new LinkedList<>();
-    mods.add(mod1);
-    mods.add(mod2);
+    List<Modification> mods = newLinkedList(mod1, mod2);
 
     replayModifies(entry, hist, mods, 11);
-    assertEquals(mods.size(), 2,
-      "DEL and ADD of the same attribute same value was not correct");
-    assertEquals(mods.get(0), mod1,
-      "DEL and ADD of the same attribute same value was not correct");
-    assertEquals(mods.get(1), mod2,
-      "DEL and ADD of the same attribute same value was not correct");
+    assertThat(mods).as("DEL and ADD of the same attribute same value was not correct").containsExactly(mod1, mod2);
     attr = buildSyncHist(DESCRIPTION,
         ":000000000000000b000000000000:add:Init Value");
     assertEquals(hist.encodeAndPurge(), attr);
@@ -961,19 +957,12 @@
     attr = Attributes.empty(DESCRIPTION);
     Modification mod2 = new Modification(ModificationType.REPLACE, attr);
 
-    List<Modification> mods = new LinkedList<>();
-    mods.add(mod1);
-    mods.add(mod2);
+    List<Modification> mods = newLinkedList(mod1, mod2);
 
     List<Modification> mods2 = new LinkedList<>(mods);
     replayModifies(entry, hist, mods, 12);
     assertEquals(hist.encodeAndPurge(), attrDel);
-    assertEquals(mods.size(), 2,
-      "DEL one value, del by Replace of the same attribute was not correct");
-    assertEquals(mods.get(0), mod1,
-      "DEL one value, del by Replace of the same attribute was not correct");
-    assertEquals(mods.get(1), mod2,
-      "DEL one value, del by Replace of the same attribute was not correct");
+    assertThat(mods).as("DEL one value, del by Replace of the same attribute was not correct").containsExactly(mod1, mod2);
 
     // Replay the same modifs again
     replayModifies(entry, hist, mods2, 12);
@@ -1004,20 +993,13 @@
     attr = Attributes.create(DESCRIPTION, "Init Value");
     Modification mod2 = new Modification(ModificationType.DELETE, attr);
 
-    List<Modification> mods = new LinkedList<>();
-    mods.add(mod1);
-    mods.add(mod2);
+    List<Modification> mods = newLinkedList(mod1, mod2);
 
     replayModifies(entry, hist, mods, 11);
     attr = buildSyncHist(DESCRIPTION,
         ":000000000000000b000000000000:del:Init Value");
     assertEquals(hist.encodeAndPurge(), attr);
-    assertEquals(mods.size(), 2,
-      "DEL and ADD of the same attribute same value was not correct");
-    assertEquals(mods.get(0), mod1,
-      "DEL and ADD of the same attribute same value was not correct");
-    assertEquals(mods.get(1), mod2,
-      "DEL and ADD of the same attribute same value was not correct");
+    assertThat(mods).as("DEL and ADD of the same attribute same value was not correct").containsExactly(mod1, mod2);
   }
 
   /**
@@ -1320,15 +1302,12 @@
     entry.applyModifications(mods);
   }
 
-  private void replayModifies(
-      Entry entry, EntryHistorical hist, List<Modification> mods, int date)
+  private void replayModifies(Entry entry, EntryHistorical hist, List<Modification> mods, int date)
   {
-    InternalClientConnection aConnection =
-      InternalClientConnection.getRootConnection();
     CSN t = new CSN(date, 0, 0);
 
     ModifyOperationBasis modOpBasis =
-      new ModifyOperationBasis(aConnection, 1, 1, null, entry.getName(), mods);
+      new ModifyOperationBasis(getRootConnection(), 1, 1, null, entry.getName(), mods);
     LocalBackendModifyOperation modOp = new LocalBackendModifyOperation(modOpBasis);
     ModifyContext ctx = new ModifyContext(t, "uniqueId");
     modOp.setAttachment(SYNCHROCONTEXT, ctx);
@@ -1543,19 +1522,17 @@
 
     // Create description with values value1 and value2 and add
     // this attribute to the entry.
-    AttributeBuilder builder = new AttributeBuilder(DESCRIPTION);
-    builder.add("value1");
-    builder.add("value2");
+    Attribute attr = Attributes.create(DESCRIPTION, "value1", "value2");
 
     List<ByteString> duplicateValues = new LinkedList<>();
-    entry.addAttribute(builder.toAttribute(), duplicateValues);
+    entry.addAttribute(attr, duplicateValues);
 
     // load historical from the entry
     EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
 
     // simulate a delete of same value in the same operation done at time t1
     testModify(entry, hist, 1, true, buildMod(DESCRIPTION, ModificationType.DELETE, "value1"));
-    Attribute attr = buildSyncHist(DESCRIPTION,
+    attr = buildSyncHist(DESCRIPTION,
         ":0000000000000001000000000000:del:value1");
     assertEquals(hist.encodeAndPurge(), attr);
 
@@ -1583,11 +1560,8 @@
 
     // The entry should have no value
     List<Attribute> attrs = entry.getAttribute(DESCRIPTION);
-    builder = new AttributeBuilder(DESCRIPTION);
-    builder.add("value2");
-    builder.add("value3");
-    builder.add("value4");
-    assertEquals(attrs.get(0), builder.toAttribute());
+    attr = Attributes.create(DESCRIPTION, "value2", "value3", "value4");
+    assertEquals(attrs.get(0), attr);
   }
 
   /**
@@ -1601,20 +1575,17 @@
 
     // Create description with values value1 and value2 and add
     // this attribute to the entry.
-    AttributeBuilder builder = new AttributeBuilder(DESCRIPTION);
-    builder.add("value1");
-    builder.add("value2");
-    builder.add("value3");
+    Attribute attr = Attributes.create(DESCRIPTION, "value1", "value2", "value3");
 
     List<ByteString> duplicateValues = new LinkedList<>();
-    entry.addAttribute(builder.toAttribute(), duplicateValues);
+    entry.addAttribute(attr, duplicateValues);
 
     // load historical from the entry
     EntryHistorical hist = EntryHistorical.newInstanceFromEntry(entry);
 
     // simulate a delete of a value in the same operation done at time t1
     testModify(entry, hist, 1, true, buildMod(DESCRIPTION, ModificationType.DELETE, "value1"));
-    Attribute attr = buildSyncHist(DESCRIPTION,
+    attr = buildSyncHist(DESCRIPTION,
         ":0000000000000001000000000000:del:value1");
     assertEquals(hist.encodeAndPurge(), attr);
 
@@ -1644,10 +1615,8 @@
 
     // The entry should have no value
     List<Attribute> attrs = entry.getAttribute(DESCRIPTION);
-    builder = new AttributeBuilder(DESCRIPTION);
-    builder.add("value3");
-    builder.add("value4");
-    assertEquals(attrs.get(0), builder.toAttribute());
+    attr = Attributes.create(DESCRIPTION, "value3", "value4");
+    assertEquals(attrs.get(0), attr);
   }
 
   /**

--
Gitblit v1.10.0