answer: BDG
A. wrong
there is no Arrays.of
B. correct
UnmodifiableList
C. not correct
C. is not correct
List.of disallow null elements
IN general unlike sets, lists typically allow duplicate elements. For example ArrayList
D. correct
static <K,V> Map<K,V> of(K k1, V v1) from Java 11
E. wrong
static <E> List<E> of(E e1, E e2)
F. wrong
A collection that contains no duplicate elements
G. correct
static <E> Set<E> of(E e1, E e2)
B. var loc = List.of("UK", "US"); D. var loc = Map.of("UK", 1, "US", 2); G. var loc = Set.of("UK", "US");
List.of, Map.of, and Set.of are all valid methods for creating unmodifiable collections of their respective types. The other options are invalid because: A. Arrays.of is not a valid method. C. List.of does not allow null elements. E. ArrayList.of is not a valid method. F. Set.of does not allow duplicate elements.
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ASPushkin
3 months, 2 weeks agoASPushkin
3 months, 2 weeks agod7bb0b2
1 year agoOmnisumem
1 year, 3 months agoAshan_Ozlov
1 year, 3 months ago[Removed]
1 year, 4 months agoStavok
1 year, 5 months ago