Skip to content

Conversation

jchen293
Copy link
Contributor

@jchen293 jchen293 commented Jan 31, 2022

What?

Improve the createList method in the Tracker class

Why?

Currently, our createList method in the Tracker class is doing extra work which refactors the user input. The user is also creating an extra list and map. Overall, this extra work would downgrade the runtime performance which takes O(n) time complexity for createList method, and when the user mistypes "trackers" as the key for input map, a NullPointerException could be thrown.

How?

Instead of asking the user to input a map that must have "trackers" as the key and a list of maps as value, we now just need the user to enter a map of maps where the key is the number of trackers and value is a map of tracking_code and carrier.

Testing?

Modify the unit test to accommodate the code change.

Copy link
Member

@Justintime50 Justintime50 left a comment

Choose a reason for hiding this comment

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

Nice work!

@Justintime50 Justintime50 marked this pull request as ready for review January 31, 2022 22:47
@Justintime50 Justintime50 merged commit 6a056bd into master Feb 1, 2022
@Justintime50 Justintime50 deleted the improve_create_list_tracker branch February 1, 2022 16:52
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.

3 participants