How to assign a value to a list in java? If Ii assign a following value it shows cannot convert from int[] to List<Integer>
public class GetAddonProductsProcessorTest {
@Test
public void AddonProductstest() throws Exception{
//BasicDBList newobj = new BasicDBList();
List<Integer> newobj = {1,2,3};
}
您可以使用 Arrays.asList 创建列表
ArrayList<Integer> newObj = new ArrayList(Arrays.asList(new Integer[]{1,2,3}));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.