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

Method insert

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

Source from the content-addressed store, hash-verified

24
25 //insert function
26 public void insert(int value)
27 {
28 //if size is less than defined size regular addition
29 if (size > i)
30 {
31 lastIndex++;
32 arr[lastIndex] = value;
33 i++;
34 display();
35 }
36
37 //if the size is more then it first increases the size and then performs addition in the array
38 else
39 {
40 increaseSize();
41 lastIndex++;
42 arr[lastIndex] = value;
43 i++;
44 display();
45 }
46 }
47
48 //incrase size function - it doubles the size and copie the elements of old array in the new array
49 private void increaseSize()

Callers 1

mainMethod · 0.95

Calls 2

displayMethod · 0.95
increaseSizeMethod · 0.95

Tested by

no test coverage detected