Quantcast
Channel: Answers for "Remove element from array"
Viewing all articles
Browse latest Browse all 5

Answer by ravenclarico

$
0
0
Most people will tell you to use Lists instead, however that's a cop-out and doesnt really answer the question (but they're probably right) if you really need to remove an element from an array, and you can't use lists or any other libraries, I'm pretty sure the only way is to create a new array and replace the old one with it. below is an example of a function that you could use to do that int[] removeAtIndex(int[] inputArray, int index){ int[] outputArray= new int[inputArray.length-1]; for(int i=0;i

Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>