MCPcopy Create free account
hub / github.com/SquirrelJME/SquirrelJME / add

Method add

runt/apis/cldc-compact/java/util/ArrayList.java:78–118  ·  view source on GitHub ↗

{@inheritDoc} @since 2018/10/28

(int __i, E __v)

Source from the content-addressed store, hash-verified

76 * @since 2018/10/28
77 */
78 @Override
79 @SuppressWarnings({"unchecked"})
80 public void add(int __i, E __v)
81 throws IndexOutOfBoundsException
82 {
83 int size = this._size;
84 if (__i < 0 || __i > size)
85 throw new IndexOutOfBoundsException("IOOB");
86
87 E[] elements = this._elements;
88 int cap = elements.length,
89 nextsize = size + 1;
90
91 // Cannot fit in this array
92 E[] source = elements;
93 if (nextsize > cap)
94 {
95 // Grow the list by a bit
96 int newcap = nextsize + _GROWTH;
97 elements = (E[])new Object[newcap];
98
99 // Copy old stuff over, but only up to the index as needed
100 for (int i = 0; i < __i; i++)
101 elements[i] = source[i];
102 }
103
104 // Move down to fit
105 for (int i = size - 1, o = size; o > __i; i--, o--)
106 elements[o] = source[i];
107
108 // Store data here
109 elements[__i] = __v;
110
111 // Store new information
112 this._size = nextsize;
113 if (elements != source)
114 this._elements = elements;
115
116 // Structurally modified
117 this.modCount++;
118 }
119
120 @Override
121 public boolean addAll(Collection<? extends E> __a)

Callers 15

runMethod · 0.95
PCFBitmapMethod · 0.95
newCompilerRunnableMethod · 0.95
__frameMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
__parseInputMethod · 0.95
getDisplaysMethod · 0.95
getAvailableFontsMethod · 0.95
EntryPointsMethod · 0.95
getSuitesMethod · 0.95
__allSuitesMethod · 0.95

Calls

no outgoing calls

Tested by 3

mainMethod · 0.76
mainMethod · 0.76
__parseInputMethod · 0.76