Which design pattern is represented by the following code?

List<String> strings = Arrays.asList("hello, ", "world", "!");
Method Arrays.asList(...) takes array as an argument and returns a List containing elements of that array. The method returns an instance of Arrays.ArrayList and this object adapts the array to the List interface.
Read more: Adapter pattern
This method is also a factory method for List.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Продовжуйте вивчати
тести з Java
Зареєструйся Зараз
або Підпишись на майбутні тести