change
Array.asList
to
Arrays.asList
asList
method is available on Arrays
class not in Array
List<CustomClass> list= Arrays.asList(new CustomClass[]{valueOne,valueTwo});
Question
In an app I am working on, I want to return an Iterable or a subclass of Iterable and pass in the values directly. So I'm trying to do something like this:
private CustomClass valueOne;
private CustomClass valueTwo;
public Iterable<? extends CustomClass> children() {
return Array.asList(valueOne, valueTwo);
}
The thing is, asList
doesn't seem to work. Is there anything like this that I could use? I've been searching but I can't seem to find anything that works in my case.
Solution
change
Array.asList
to
Arrays.asList
asList
method is available on Arrays
class not in Array
List<CustomClass> list= Arrays.asList(new CustomClass[]{valueOne,valueTwo});