Skip to content

Removing from front of ArrayList #5

@niemasd

Description

@niemasd

I'm not sure how time-consuming this step is, so not sure if it is negligible:

https://github.com/emmahodcroft/cluster-picker-and-cluster-matcher/blob/master/src/clusterPicking/ClusterPicker.java#L456

But you are storing the things you want to process in an ArrayList, but you're iteratively removing from the front of the ArrayList, which is O(n) each time (where n is the number of elements in the ArrayList). You should use a Queue (which is implemented as a LinkedList) for O(1) removal from the front, given that you don't care about random access of elements

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