Which design pattern is represented by the following code?

List<String> strings = Arrays.asList("hello, ", "world", "!");
Explanation
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
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты