I am trying to return False if result = false. I can't change the return type. linkList needs to return false if result = false. Thanks
private static class FilteringFlatApplyFunction<T> implements FlatApplyFunction<T,T> {
private final Predicate pred;
LinkedList<T> linkList = new LinkedList<T>();
public FilteringFlatApplyFunction(Predicate<T> p) {
this.pred = p;
this.linkList = linkList;
}
@Override
public List<T> apply(T x){
boolean result = pred.check(x);
if (result = true) {
linkList.add(x);
return linkList;
}
if (result = false) {
linkList = false;
}
return linkList;
}
}