Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method toArray to Heap #3079

Merged
merged 4 commits into from
Jan 13, 2023
Merged

Conversation

masx200
Copy link
Contributor

@masx200 masx200 commented Jan 2, 2023

fixes #3076

Returns the underlying cloned array in arbitrary order without sorting

@masx200
Copy link
Contributor Author

masx200 commented Jan 4, 2023

I also feel that it's confusing that [...tree] and tree.toArray() have significantly different meanings. Could this be named in better way?

Please give a better name to this method. @kt3k

@kt3k
Copy link
Member

kt3k commented Jan 4, 2023

Java, Rust, and Dart seem giving just generic names.
Java - toArray https://docs.oracle.com/javase/jp/8/docs/api/java/util/PriorityQueue.html
Rust - into_vec https://doc.rust-lang.org/std/collections/struct.BinaryHeap.html#method.into_vec
Dart - toArray https://pub.dev/documentation/pathfinding/latest/pathfinding.core.heap/Heap/toArray.html

Flutter's collection package gives explicit name.
Flutter - https://api.flutter.dev/flutter/package-collection_collection/HeapPriorityQueue-class.html

I now feel toArray might be just fine.

Does anyone have any opinion on this?

cc @KyleJune

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

LGTM

@kt3k kt3k merged commit 1999443 into denoland:main Jan 13, 2023
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.

Add method toArray to Heap
2 participants