java - How can i move in string array item to the end of the array? -


ipaddresses = ipaddresses.generateips(); 

the array contain 56 items. want item in index 2 remove end of array. content in index 2 in index 56. array size not change order of items. item 2 in place 56. think index 3 index 2.

you can use system.arraycopy. similar happens when remove element arraylist, in case moving removed element end :

e element = elementdata[index]; // element removed int nummoved = elementdata.length - index - 1; // move elements follow moved element if (nummoved > 0)     system.arraycopy(elementdata, index+1, elementdata, index, nummoved); // put moved element @ end elementdata[elementdata.length - 1] = element; 

here elementdata array , move element @ index position end.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -