This post originated from an RSS feed registered with Java Buzz
by Arpit Mandliya.
Original Post: Java program to Remove element from array
Feed Title: Java tutorial for beginners
Feed URL: http://feeds.feedburner.com/arpitmandliyasblog
Feed Description: A blog about java programming language and its frameworks
In this post, we will see how to remove an element from array in java. Unlike Arraylist,Java Arrays class does not provide any direct method to add or delete element. As Array is fixed size in nature, you can not shrink or grow it dynamically. You need to create new array and copy all elements except the element which you want to remove. If you have no duplicates in array, you can simply use Apache common’s ArrayUtil class.It has removeElement method which removes first occurence of the element from the array and return new array. Remove element from array with inbuilt