Skip to content

Implement custom ArrayList with dynamic array resizing#1786

Open
DanyilShkodiuk wants to merge 1 commit into
mate-academy:masterfrom
DanyilShkodiuk:jv-array-list
Open

Implement custom ArrayList with dynamic array resizing#1786
DanyilShkodiuk wants to merge 1 commit into
mate-academy:masterfrom
DanyilShkodiuk:jv-array-list

Conversation

@DanyilShkodiuk
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your ArrayList implementation is approved. The code correctly implements all required functionality: it properly implements the List interface with appropriate method overrides, uses a 1.5x growth factor with a default capacity of 10 (both extracted to named constants), throws custom ArrayListIndexOutOfBoundsException with informative messages including index and size values, uses System.arraycopy() appropriately, and follows DRY principles with separate private methods for index checking and array growth. The empty line formatting issues mentioned in the file comments fall under style/whitespace concerns which are non-blocking issues that can be addressed separately with the linter. All core requirements are met and functionality is correct.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

package core.basesyntax;

import java.util.NoSuchElementException;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before class declaration violates checklist item #1: "Don't begin class or method implementation with an empty line."

elementData[size] = value;
size++;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."

elementData[index] = value;
size++;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."

add(list.get(i));
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."

checkIndex(index);
return (T) elementData[index];
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."

return 0;
return size;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."

return false;
return size == 0;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."

elementData = grownArray;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."

"Index " + index + " is out of bounds for size " + size);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."

"Index " + index + " is out of bounds for size " + size);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants