Array not deleting?

Other related stuff

Array not deleting?

Unread postby kokilasoral » 04 Jun 2016, 05:32

In my first technique i want to delete a component at a position but instead of deleting, it variations the element to 0.
@Override
public void delete AtPostion(int position) {
size-- ;
for (int i = 0; i < list.length; i++){
if (i == position){
list [i] = list [size];
} } }

In the other technique i want to delete a value, but instead of deleting a value from list, it find the location instead of value and sub stracts by 1..
eg: if my input value is to delete 3, instead if sub stracts 1 from position 3.
public void delete Values(int value) {
size-- ;
for (int i = 0;i < list.length; i++)
if (value == list [i]) {
list [ value]--;
}
}

what do i need to alter, to make it work the way i need??
kokilasoral
 
Posts: 2
Joined: 03 Jun 2016, 12:07
Has thanked: 0 time
Been thanked: 0 time

Return to Off Topic

Who is online

Users browsing this forum: No registered users and 1 guest