Why is it wrong to rewrite lambda expressions with objects?

the following code:

public class App {
    public static void main(String[] args) throws IOException
    {
        class Test<T extends Comparable> implements Predicate<T> {
            public boolean test(T t){
                return t.equals("grayVTouch");
            }
        }
        ArrayList<String> a = new ArrayList<>();
        a.add("grayVTouch");
        a.add("yueshu");
        a.add("shuyue");
        Stream<String> s = a.stream();
        Test<String> t = new Test<>();
        a = a.filter(t);
    }
}

error report:

clipboard.png

Why is this?

Aug.19,2021

filter is the method of stream , not the method of ArrayList , so it should be s.filter . The s of the subject is initialized, isn't it gray? Doesn't that mean you haven't used it? (cover your face)

Menu