mercredi 28 novembre 2018

How to get last value from an ArrayList using reflection?

I simply want to get the last value in an ArrayList using reflection. Typically this is achieved by doing:

int x = ArrayList.get(ArrayList.size()-1);

I've tried doing:

int x = Object.get(ClassInstance, Object.get(ClassInstance, ArrayList.size()-1));

Obviously this isn't the correct syntax. What would the correct syntax be to achieve this?





Aucun commentaire:

Enregistrer un commentaire