How to replace an array with an arraylist?

How to replace the next array with an ArrayList.

Employee[] companyTeam = {manager, engineer1, superviso1, accountant, intern };
+4
source share
2 answers

You can do something like

List<Employee> companyTeam = Arrays.asList(manager, engineer1, superviso1, accountant, intern);
+3
source
 Employee[] companyTeam = {manager, engineer1, superviso1, accountant, intern };
 List<Employee>  list=Arrays.asList(companyTeam);// array to List

You already have an array, so you can use Arrays.asList(companyTeam)to convert the array toList

0
source

Source: https://habr.com/ru/post/1523358/