Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

No description provided.

}
},
testM("removeIf") {
val elems = List(2, 4, 6, 3, 5, 6)
Copy link
Contributor

@phderome phderome Jun 12, 2020

Choose a reason for hiding this comment

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

you could possibly choose the even numbers out of order here to show evidence that the priority matters (and similarly for odds)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to a property based test to cover that.

*/
def takeAll: USTM[List[A]] =
map.size.flatMap(n => STM.collectAll(STM.replicate(n)(take)))
ref.modify(map => (map.flatMap { case (k, v) => List.fill(v)(k) }.toList, map.empty))
Copy link
Contributor

Choose a reason for hiding this comment

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

ha, v is the count reference of how many times k occurs.

Copy link
Contributor

@phderome phderome left a comment

Choose a reason for hiding this comment

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

looks good.

@adamgfraser
Copy link
Contributor Author

@phderome Thank you for taking a look!

@adamgfraser adamgfraser requested a review from jdegoes June 12, 2020 01:14
@adamgfraser adamgfraser requested a review from mijicd June 12, 2020 16:41
Copy link
Member

@mijicd mijicd left a comment

Choose a reason for hiding this comment

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

Looks great!

@adamgfraser adamgfraser merged commit 962cfd7 into zio:master Jun 12, 2020
@adamgfraser adamgfraser deleted the tpriorityqueue branch June 12, 2020 20:14
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