Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lisichenkowork committed Nov 27, 2024
1 parent 0f8714e commit 11d5b09
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/core/basesyntax/ArrayList.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private Object[] grow() {
return elementData;
}

public void checkIfElementExsist(T element) {
public void checkIfElementExists(T element) {
boolean found = false;

// Перебираємо елементи масиву
Expand Down Expand Up @@ -103,7 +103,7 @@ public T remove(int index) {

@Override
public T remove(T element) {
checkIfElementExsist(element);
checkIfElementExists(element);
for (int i = 0; i < size; i++) {
if ((element == null && elementData[i] == null)
|| (element != null && element.equals(elementData[i]))) {
Expand All @@ -129,7 +129,7 @@ public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[");

for (int i = 0; i < elementData.length; i++) {
for (int i = 0; i < size; i++) {
if (elementData[i] == null) {
return sb.append("]").toString();
}
Expand Down

0 comments on commit 11d5b09

Please sign in to comment.