Skip to content

Commit 7420a54

Browse files
committed
Renaming variables
1 parent ed263ab commit 7420a54

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed
3 Bytes
Binary file not shown.

javacs-lab02/src/com/flatironschool/javacs/MyArrayList.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ public static void main(String[] args) {
4545
}
4646

4747
@Override
48-
public boolean add(E e) {
48+
public boolean add(E element) {
4949
if (size >= array.length) {
5050
// make a bigger array and copy over the elements
5151
E[] bigger = (E[]) new Object[array.length * 2];
5252
System.arraycopy(array, 0, bigger, 0, array.length);
5353
array = bigger;
5454
}
55-
array[size] = e;
55+
array[size] = element;
5656
size++;
5757
return true;
5858
}
@@ -66,16 +66,16 @@ public void add(int index, E element) {
6666
}
6767

6868
@Override
69-
public boolean addAll(Collection<? extends E> c) {
69+
public boolean addAll(Collection<? extends E> collection) {
7070
boolean flag = true;
71-
for (E e: c) {
72-
flag &= add(e);
71+
for (E element: collection) {
72+
flag &= add(element);
7373
}
7474
return flag;
7575
}
7676

7777
@Override
78-
public boolean addAll(int index, Collection<? extends E> c) {
78+
public boolean addAll(int index, Collection<? extends E> collection) {
7979
throw new UnsupportedOperationException();
8080
}
8181

@@ -87,14 +87,14 @@ public void clear() {
8787
}
8888

8989
@Override
90-
public boolean contains(Object o) {
91-
return indexOf(o) != -1;
90+
public boolean contains(Object obj) {
91+
return indexOf(obj) != -1;
9292
}
9393

9494
@Override
95-
public boolean containsAll(Collection<?> c) {
96-
for (Object e: c) {
97-
if (!contains(e)) {
95+
public boolean containsAll(Collection<?> collection) {
96+
for (Object element: collection) {
97+
if (!contains(element)) {
9898
return false;
9999
}
100100
}
@@ -171,8 +171,8 @@ public ListIterator<E> listIterator(int index) {
171171
}
172172

173173
@Override
174-
public boolean remove(Object o) {
175-
int index = indexOf(o);
174+
public boolean remove(Object obj) {
175+
int index = indexOf(obj);
176176
if (index == -1) {
177177
return false;
178178
}
@@ -187,16 +187,16 @@ public E remove(int index) {
187187
}
188188

189189
@Override
190-
public boolean removeAll(Collection<?> c) {
190+
public boolean removeAll(Collection<?> collection) {
191191
boolean flag = true;
192-
for (Object o: c) {
193-
flag &= remove(o);
192+
for (Object obj: collection) {
193+
flag &= remove(obj);
194194
}
195195
return flag;
196196
}
197197

198198
@Override
199-
public boolean retainAll(Collection<?> c) {
199+
public boolean retainAll(Collection<?> collection) {
200200
throw new UnsupportedOperationException();
201201
}
202202

@@ -226,7 +226,7 @@ public Object[] toArray() {
226226
}
227227

228228
@Override
229-
public <T> T[] toArray(T[] a) {
229+
public <T> T[] toArray(T[] array) {
230230
throw new UnsupportedOperationException();
231231
}
232232
}

linked_list_diagram1.png

-34.1 KB
Binary file not shown.

linked_list_diagram1.xcf

-54.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)