Skip to content

Comments

complete task ArrayList#1751

Open
wiwalentusr-ux wants to merge 2 commits intomate-academy:masterfrom
wiwalentusr-ux:arrayList
Open

complete task ArrayList#1751
wiwalentusr-ux wants to merge 2 commits intomate-academy:masterfrom
wiwalentusr-ux:arrayList

Conversation

@wiwalentusr-ux
Copy link

No description provided.

Copy link

@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

I am requesting changes because there is at least one critical, blocking issue that will prevent your solution from compiling and fully meeting the task requirements. Your ArrayList implementation itself is solid: it implements the List interface correctly, uses a default capacity of 10, grows the backing array by a 1.5 factor in a dedicated grow() method, and uses System.arraycopy() and NoSuchElementException where appropriate. However, the code throws ArrayListIndexOutOfBoundsException, but the corresponding custom exception class is not present in the project; this will cause a compilation error and violates the requirement to provide that custom exception class. To fix this, add a class like core.basesyntax.ArrayListIndexOutOfBoundsException that extends IndexOutOfBoundsException (or RuntimeException) and includes a constructor accepting a message, then ensure all your throw new ArrayListIndexOutOfBoundsException(...) calls use it.

Once that is in place, consider, as non-blocking improvements, adjusting your addAll growth logic to use the required capacity size + list.size() instead of the source array length and renaming any helper like get(T value) to indexOf(T value) for clarity and alignment with java.util.List. Despite these tweaks, the core logic of your list is well-structured and close to production-ready; resolving the custom exception issue will make the solution fully complete.


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

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Copy link

@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

I am approving your solution because all functional and core task requirements are met: your ArrayList correctly implements the List interface, uses the required default capacity and growth factor, resizes via a dedicated grow(...) method with System.arraycopy(...), and properly throws the custom ArrayListIndexOutOfBoundsException and NoSuchElementException where required. The remaining issue in src/main/java/core/basesyntax/ArrayListIndexOutOfBoundsException.java is purely stylistic: remove the empty line right after the package declaration and any redundant blank line at the end of the file to align with the style guideline about leading/trailing empty lines [CHECKLIST ITEM #1]. This does not block functionality or task completion, but you should still fix it to avoid style-related comments in future reviews.

As a minor improvement, continue to keep your exception messages as informative as possible (e.g., including index and size where relevant) to make debugging easier. Overall, the design of your ArrayList (separate helper methods, clear growth logic, and proper exception usage) shows a solid understanding of the task. Nice work bringing the implementation in line with the earlier review comments; just polish those small formatting details going forward.


✨ 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;

public class ArrayListIndexOutOfBoundsException extends RuntimeException {
public class ArrayListIndexOutOfBoundsException extends IndexOutOfBoundsException {

Choose a reason for hiding this comment

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

This violates checklist item #1: "Don't begin class or method implementation with an empty line. Remove all redundant empty lines." There is an empty line before the class declaration (remove the blank line after the package statement) — also remove any trailing redundant blank line at the end of the file.

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