fastutil icon indicating copy to clipboard operation
fastutil copied to clipboard

HeapPriorityQueue.drv + capacity, toArray, toString

Open magicprinc opened this issue 6 months ago • 9 comments

For consistency between FIFO and Heap queues:

I have added the same methods (capacity, toArray, toString) also for Heap Priority Queues.

Results of toArray, toString are not sorted (for implementation simplicity and performance)

magicprinc avatar Jun 22 '25 10:06 magicprinc

Argh I just released 😂

vigna avatar Jun 22 '25 10:06 vigna

Can you check that in the source you're using (4-space-width) TABs? I had to fix all spacing by hand in the previous PRs.

vigna avatar Jun 22 '25 10:06 vigna

Strange! I am a big fan of TAB as indent char (it is my default settting in IDEA) Additionally IDEA shows me "Tab" as current indent in your project 🤷‍♀️

You can extra force rules with .editorconfig file in the root folder

# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
charset = utf-8
indent_style = tab
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = false
spaces_around_operators = true
tab_width = 2
indent_size = 2

ij_continuation_indent_size = 2
ij_any_align_multiline_parameters = false

[*.yaml]
indent_style = space
tab_width = 2
[*.yml]
indent_style = space
tab_width = 2

https://github.com/vigna/fastutil/pull/359

magicprinc avatar Jun 22 '25 11:06 magicprinc

I have extra checked: it is TAB on my side 🤷‍♀️ screenshot ve TAB, not spaces

magicprinc avatar Jun 22 '25 11:06 magicprinc

screenshot HeapPriorityQueue.drv uses TAB (I have double-checked) FastByteArrayOutputStream also 👍 But ArrayFIFOQueue.drv somehow uses mix of tabs and spaces 🤦‍♂️

I think .editorconfig + my extra IDEA configuration (treat .drv as .java) must help 👍

magicprinc avatar Jun 22 '25 12:06 magicprinc

If I can do anything with this PR, please feel free to command 🙏

magicprinc avatar Aug 25 '25 08:08 magicprinc

I'm on vacation now—I will be able to look into this mid-September.

vigna avatar Aug 25 '25 08:08 vigna

Two observations:

  • Capacity/toArray is ok but you have to implement it for all queues based on arrays (heap queues and array queues) for uniformity.
  • toString could be done with some streaming (.collect(Collectors.joining(", "));

vigna avatar Sep 29 '25 14:09 vigna

Now I am on Vacation 😅 So If you have time, feel free to use my PR as the initial step to your masterpiece 🤝 I will try to help when I have access to the desk and Internet

magicprinc avatar Sep 29 '25 18:09 magicprinc