Skip to content

Iterator is Slow #4

Description

@snakemasterepic

Iterator is not optimized

Build Number: 8

Priority: Medium

Severity: High

Summary

The iterator currently calls backboneIndex() and addWrinkle() which are slow.

Issue Producing Code

QuickList<String> q1 = new QuickList<>();
// Populate Q1
q1.cleanup();
// Make some more changes to the elements of q1
ListIterator<String> it = q1.listIterator();
while (it.hasNext()) {
    String s = it.next(); // Calls backboneIndex()
    if (s.equals("Cat")) {
        it.add("Dog"); // Calls addWrinkle()
    }
}
while (it.hasPrevious()) {
    String s = it.previous(); // Calls backboneIndex()
    if (s.equals("Delete me!") {
        it.remove(); // Calls addWrinkle()
    }
}

Observed Output

The list is not optimized and is slower than ideal.

Expected Output

The list is optimized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions