Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The method asList(T[]) in the type Arrays is not applicable for the arguments (int, int)

Tags:

java

arrays

list

I am using jdk1.8.0_121 on eclipse kepler (My OS is windows 7), I have created a simple project contained one class with static main method.

When I tried to create a list as follow

List l = Arrays.asList(1,2);

I got this error :

The method asList(T[]) in the type Arrays is not applicable for the arguments (int, int).

like image 312
Amal Abidi Avatar asked Apr 11 '17 09:04

Amal Abidi


2 Answers

In case anyone else comes across a similar issue, I found that I had this error because I was importing edu.emory.mathcs.backport.java.util.Arrays; instead of java.util.Arrays;

like image 147
simonalexander2005 Avatar answered Oct 03 '22 21:10

simonalexander2005


I have faced same issue like wrongly imported org.javers.common.collection.arrays So removed that one and imported from Utils Arrays got

like image 43
Prabu M Avatar answered Oct 03 '22 21:10

Prabu M