From a599a26d6fe93f9d3b41ba028af54d808eb31d24 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 08 Aug 2016 07:31:25 +0000
Subject: [PATCH] Partial OPENDJ-3106 Migrate Entry
---
opendj-server-legacy/src/main/java/org/opends/server/util/CollectionUtils.java | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/CollectionUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/util/CollectionUtils.java
index 86de78d..6aea607 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/CollectionUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/CollectionUtils.java
@@ -11,11 +11,17 @@
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions Copyright [year] [name of copyright owner]".
*
- * Copyright 2014-2015 ForgeRock AS.
+ * Copyright 2014-2016 ForgeRock AS.
*/
package org.opends.server.util;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.TreeSet;
/**
* Utility class for {@link Collection}s.
@@ -97,4 +103,26 @@
{
return new TreeSet<>(Arrays.asList(elements));
}
+
+ /**
+ * Collects all the elements from the provided iterable into the provided collection.
+ *
+ * @param <C>
+ * The type of the collection
+ * @param <E>
+ * The type of the iterable's elements
+ * @param iterable
+ * the iterable from which to read elements
+ * @param outputCollection
+ * the collection where to add the iterable's elements
+ * @return the provided collection
+ */
+ public static <C extends Collection<E>, E> C collect(Iterable<E> iterable, C outputCollection)
+ {
+ for (E e : iterable)
+ {
+ outputCollection.add(e);
+ }
+ return outputCollection;
+ }
}
--
Gitblit v1.10.0