Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a Iterator Design Pattern in the LinkedListUS Class #4

Open
JamesIGT opened this issue Dec 17, 2024 · 0 comments
Open

Using a Iterator Design Pattern in the LinkedListUS Class #4

JamesIGT opened this issue Dec 17, 2024 · 0 comments

Comments

@JamesIGT
Copy link

JamesIGT commented Dec 17, 2024

The implementation of the Iterator design pattern improves encapsulation and facilitates traversing the list, avoiding exposure of its internal structure while remaining open to extension, thus adhering to the Open/Closed Principle (OCP). The iteration logic is separated into the LinkedListIterator class, aligning with the Single Responsibility Principle (SRP), which enhances code maintainability and flexibility. However, this redesign introduces a slight additional cost in memory and processing due to the creation of the iterator, although the impact is minimal.
image
image
image

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

No branches or pull requests

1 participant