I am trying to transform an array of Cause to an ArrayList of Cause and i get this compiler error:
Type mismatch: cannot convert from ArrayList<Cause> to Cause[]
This is the implementation:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class MyException extends Exception
private List<Cause> causes;
public MyException(Cause... causes) {
causes = new ArrayList<Cause>(Arrays.asList(causes));
}
}
How can I convert that causes that I am receiving as a parameter to the List member? (I don't want to change parameter's type). Do you have any idea?
(Arrays.asList(causes)).causesrefer to in your constructor?