dimanche 8 mars 2015

How to use Java class type in code



I've used and extended classes where the name looks like ArrayAdapter<String> or HashMap<String, String>, but how can implement the type inside the <> myself? For example, I have a class that is currently used to store callback data. It looks like:



static class APICallback {
boolean status;
JsonObject data;
}


Is there a way for me to implement this so that I can code something like APICallback<List<String>> and have it know the data field will be a List<String> vs a JsonObject?




Aucun commentaire:

Enregistrer un commentaire