I have a list of Class1
, which has a method isAvailable()
which returns a boolean.
I am trying to create an array of boolean from this.
So far I have tried the below:
List<Class1> class1List;
boolean[] isAvailableArray = class1List.stream()
.map(e -> e.isAvailable())
.toArray();
However this is throwing a can't convert from Object[]
to boolean[]
error.
What is the reason for this.