I am very new to Java 8 features like streams, filters and stuff and the tell the truth, I haven't been writing in Java for more than a year. Here is my problem if someone could give a suggestion .
@Override
public ArrayList<Agent> getAllEnabledAgents() throws Exception {
ArrayList<Agent> agents = repository.all(); //redis repository
Stream<Agent> result = agents.stream().filter(a-> a.equals(a.getConfigState().Enabled)); //enum
return result; //I dont know how to return result or whether I am using stream correctly.
}
The main idea is that I want return all enabled agents. gerConfigState() returns an enum (__ConfigState). not sure If am doing this correctly.