java - continuously changing array size -
this question has answer here:
i have array of strings values in array changing continuously. there other way of managing array except removing items , changing index locations?
public string[] deviceid=null; deviceid=new string[devicecount];
in case devicecount changes new device comes. continuously need change array size , add or remove items
use arraylist in place of string[] .. , can cast arraylist string[] final output as
arraylist<string> mstringlist= new arraylist<string>(); mstringlist.add("ann"); mstringlist.add("john"); string[] mstringarray = new string[mstringlist.size()]; mstringarray = mstringlist.toarray(mstringarray);
Comments
Post a Comment