Generics and lambda expressions

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.function.Consumer;


public class User {

    private <T> void test(Consumer<T> request) {
        Type[] interfaces = request.getClass().getGenericInterfaces();
        for (Type type : interfaces) {
            if (type instanceof ParameterizedType) {
                Type actualType = ((ParameterizedType) type).getActualTypeArguments()[0];
                if (actualType instanceof Class) {
                    System.out.println(actualType);
                    return;
                }
            }
        }
        System.out.println("");
    }


    public static void main(String[] args) {
        new User().test((Consumer<Integer>) integer -> {

        });
        new User().test(new Consumer<Integer>() {
            @Override
            public void accept(Integer integer) {

            }
        });
    }
}

uses lambda expression calls and normal calls in main, and gets the generics of Consumer in User.test, which cannot be obtained when using lambda expressions, but different calls can. Should I modify it to support lambda? The main reason is that I want to get the generics of the incoming Consumer, regardless of whether it is in the lambda way or not, ask for advice


I don't quite understand what you mean.
integer is not the paradigm Integer that you define?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e41cb6-4493f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e41cb6-4493f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?