feat: add size() method to MyLinkedList
This commit is contained in:
@@ -69,7 +69,14 @@ public class MyLinkedList<T> implements MyList<T>
|
|||||||
temp = temp.getNext();
|
temp = temp.getNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T oldValue = (T) temp.getValue();
|
||||||
|
temp.setValue(value);
|
||||||
|
return oldValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
public String toString() {
|
public String toString() {
|
||||||
Object[] res = new Object[size];
|
Object[] res = new Object[size];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user