[OmniFaces utilities] The
unmodifiableSet()
method creates an unmodifiable set based on the given values. If one of the values is an instance of an array or a collection, then each of its values will also be merged into the set. Nested arrays or collections will result in a ClassCastException
.Method:
Usage:
import org.omnifaces.util.Utils;
...
String a =
"1";
Integer b =
2;
Byte[] c =
new Byte[]{3, 4, 5};
List<String>
d = new ArrayList<>();
d.add("6");
d.add("7");
// the unmodifiable
Set will contain: 1,2,3,4,5,6,7
Set<Object> all =
Utils.unmodifiableSet(a, b, c, d);
Niciun comentariu :
Trimiteți un comentariu