MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / delete

Method delete

Programs/Gssarray.java:61–87  ·  view source on GitHub ↗
(int value)

Source from the content-addressed store, hash-verified

59
60 //to check whether the element to be delted is present in the array is present or not
61 public boolean delete(int value)
62 {
63 int pos = -1;
64 for (int index = 0; index < lastIndex; index++)
65 {
66 if (arr[index] == value)
67 {
68 pos = index;
69 break;
70 }
71 }
72 if (pos == -1)
73 {
74 return false;
75 }
76 else
77 {
78 System.out.println(pos);
79 for (int i = pos ; i < size - 1; i++)
80 {
81 arr[i] = arr[i + 1];
82 }
83 i--;
84 lastIndex = lastIndex - 1;
85 return true;
86 }
87 }
88
89 //display function
90 void display()

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected