How to manage Continuous Changing values in an array of strings [closed]

孤街醉人 提交于 2019-12-02 18:09:45

问题


I have an array of strings but the values in array is changing continuously changing. Is there any other way of managing the array except removing items and changing index locations?

public int[] deviceId=null;
deviceId=new String[deviceCount];

in my case deviceCount is changing as new device comes. so i continuously need to change array size and add or remove items


回答1:


Java offers a really handy mechanism known as the ArrayList. It's a dynamic array that you can use to do what you're describing.

http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html



来源:https://stackoverflow.com/questions/19216824/how-to-manage-continuous-changing-values-in-an-array-of-strings

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!