BAEL-2969: Copying sets in Java
This commit is contained in:
parent
fdf3b86d72
commit
a342b198b3
@ -0,0 +1,13 @@
|
||||
package com.baeldung.set;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class CopySets {
|
||||
|
||||
// Using Java 10
|
||||
public static <T> Set<T> copyBySetCopyOf(Set<T> original) {
|
||||
Set<T> copy = Set.copyOf(original);
|
||||
return copy;
|
||||
}
|
||||
|
||||
}
|
@ -56,10 +56,4 @@ public class CopySets {
|
||||
return copy;
|
||||
}
|
||||
|
||||
// Using Java 10
|
||||
public static <T> Set<T> copyBySetCopyOf(Set<T> original) {
|
||||
Set<T> copy = Set.copyOf(original);
|
||||
return copy;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user