Skip to content

Commit 940651a

Browse files
reintroduce and deprecate ObjectUtils.merge
Signed-off-by: Tobias Ibounig <tobias.ibounig@dynatrace.com>
1 parent 1de90b1 commit 940651a

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/main/java/dev/openfeature/sdk/HookSupport.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.ArrayList;
44
import java.util.Collection;
5-
import java.util.Collections;
65
import java.util.List;
76
import java.util.Optional;
87
import lombok.extern.slf4j.Slf4j;

src/main/java/dev/openfeature/sdk/internal/ObjectUtils.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package dev.openfeature.sdk.internal;
22

3+
import java.util.ArrayList;
4+
import java.util.Collection;
35
import java.util.List;
46
import java.util.Map;
57
import java.util.function.Supplier;
@@ -54,4 +56,22 @@ public static <T> T defaultIfNull(T source, Supplier<T> defaultValue) {
5456
}
5557
return source;
5658
}
59+
60+
/**
61+
* Concatenate a bunch of lists.
62+
*
63+
* @param sources bunch of lists.
64+
* @param <T> list type
65+
* @return resulting object
66+
* @deprecated Not used in the project anymore. This method will be removed in a future release.
67+
*/
68+
@Deprecated(forRemoval = true)
69+
@SafeVarargs
70+
public static <T> List<T> merge(Collection<T>... sources) {
71+
List<T> merged = new ArrayList<>();
72+
for (Collection<T> source : sources) {
73+
merged.addAll(source);
74+
}
75+
return merged;
76+
}
5777
}

0 commit comments

Comments
 (0)