java - Set Type of ArrayList Dynamically -


currently have set of code:

package com.sdqn.shared.property;  import java.util.arraylist; import javax.xml.bind.annotation.xmlrootelement;  @xmlrootelement public class misc_returnvalue {     public string message;     public int total;     public boolean success;     public arraylist results;      public misc_returnvalue(){         this.success = false;         this.total = 0;     } } 

the problem is, need results accept type. try follow answer here seem don't understand how use in code. can explain me how can achieve this?

try this

public class misc_returnvalue<t> {     public string message;     public int total;     public boolean success;     public arraylist<t> results = new arraylist<t>();      public misc_returnvalue(){         this.success = false;         this.total = 0;     } } 

Comments