From 5cd7bdbbda0fa9f1aa6e12d9171c3811b73feb07 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 09 Jul 2015 14:01:31 +0000
Subject: [PATCH] Code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java
index 27803b9..68df4b2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java
@@ -30,6 +30,7 @@
 import static org.opends.messages.BackendMessages.*;
 import static org.opends.messages.ConfigMessages.*;
 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.*;
 
@@ -655,14 +656,7 @@
 
   private void put(final HashMap<AttributeType, List<Attribute>> attrsMap, final Attribute attr)
   {
-    attrsMap.put(attr.getAttributeType(), toList(attr));
-  }
-
-  private ArrayList<Attribute> toList(final Attribute attr)
-  {
-    final ArrayList<Attribute> results = new ArrayList<>(1);
-    results.add(attr);
-    return results;
+    attrsMap.put(attr.getAttributeType(), newArrayList(attr));
   }
 
   /**
@@ -687,8 +681,7 @@
       {
         final AttributeType attributeType = rdn.getAttributeType(i);
         final ByteString value = rdn.getAttributeValue(attributeType);
-        final Attribute attr = Attributes.create(attributeType, value);
-        monitorUserAttrs.put(attributeType, toList(attr));
+        monitorUserAttrs.put(attributeType, Attributes.createAsList(attributeType, value));
       }
     }
 
@@ -783,7 +776,7 @@
     final AttributeType rdnType = entryRDN.getAttributeType(0);
     final ByteString rdnValue = entryRDN.getAttributeValue(0);
 
-    attrMap.put(rdnType, toList(Attributes.create(rdnType, rdnValue)));
+    attrMap.put(rdnType, Attributes.createAsList(rdnType, rdnValue));
 
     // Take the rest of the information from the monitor data.
     for (final Attribute a : monitorAttrs)

--
Gitblit v1.10.0