Implement custom ArrayList with dynamic array resizing#1786
Implement custom ArrayList with dynamic array resizing#1786DanyilShkodiuk wants to merge 1 commit into
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
| package core.basesyntax; | ||
|
|
||
| import java.util.NoSuchElementException; | ||
|
|
There was a problem hiding this comment.
Empty line before class declaration violates checklist item #1: "Don't begin class or method implementation with an empty line."
| elementData[size] = value; | ||
| size++; | ||
| } | ||
|
|
There was a problem hiding this comment.
Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."
| elementData[index] = value; | ||
| size++; | ||
| } | ||
|
|
There was a problem hiding this comment.
Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."
| add(list.get(i)); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
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]; | ||
| } | ||
|
|
There was a problem hiding this comment.
Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."
| return 0; | ||
| return size; | ||
| } | ||
|
|
There was a problem hiding this comment.
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; | ||
| } | ||
|
|
There was a problem hiding this comment.
Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."
| elementData = grownArray; | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
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); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
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); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Empty line before method implementation violates checklist item #1: "Don't begin class or method implementation with an empty line."
No description provided.