I have 3 doubles - a, b and c, passed to a method numPos as 3 different arguments. I want to count the number of positive valuse among them, hence the method's return type is int.
I thought about declaring an Array/List and adding the values to it, checking if the value is greater than 0, but I couldn't even do the first part of my idea - declaring a List and passing all the values to it. Here's the code I wrote:
public static int numPos(double a, double b, double c) {
return List<double> myList = new List<double>(DoubleStream.of(a,b,c).forEach(i -> myList.add(i))).stream().count();
}