Skip to content

Implemented the 2 methods#7

Open
AAshGray wants to merge 2 commits intogrc-cohort-21:mainfrom
AAshGray:main
Open

Implemented the 2 methods#7
AAshGray wants to merge 2 commits intogrc-cohort-21:mainfrom
AAshGray:main

Conversation

@AAshGray
Copy link
Copy Markdown

No description provided.

Comment thread src/Tallyer.java
Comment on lines +80 to +82
// You didn't say if you wanted it sorted by keys or by value
// TreeMap keys are automatically sorted, so we can put the HashMap in a TreeMap to sort by keys
TreeMap<String, Integer> sortedTallyMap = new TreeMap<>(tallyMap);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The README says "The order is unimportant", but I like that you're considering this!

Comment thread src/Tallyer.java
Comment on lines +116 to +118
With a little more work I think I could add a piece so we weren't re-checking IDs that we already know are invalid
*/
int numberEntries = Collections.frequency(ids, ids.get(i));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Very cool! I agree, there are ways to do this a bit more efficiently, but this is a really nice concise readable way of doing it. If we know our input is going to be relatively small and speed is unimportant, this is a great approach.

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