السلام عليكم
عندى مشكلة في فهم removeElementAt method و insertElementAt
ممكن تبسطولي شرحها لانني حسيتها معقده شوية وما قدرت افهمها
هي الحكاية وما فيها اننا كيف نقوم بحذف العنصر من المصفوفة ثم التخلص من الفجوة.
صح ؟
طبعا هذا الكود اللي اعطانا المدرس
public void removeElementAt(int where){
for (int i=where;i<count-1;i++)
array= array[i+1];
count--;
}وهذا الكود لinserElementAt
public void inserElementAt(Object obj,int where){
for (int i = count;i>where;i--)
array=array[i-1];
array[where]=obj;
count++;
}