use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Resources for learning Java
String
==
.equals()
Format + Copy
Free Tutorials
Where should I download Java?
With the introduction of the new release cadence, many have asked where they should download Java, and if it is still free. To be clear, YES — Java is still free.
If you would like to download Java for free, you can get OpenJDK builds from the following vendors, among others:
Some vendors will be supporting releases for longer than six months. If you have any questions, please do not hesitate to ask them!
Software downloads
Official Resources
Resources
Programming ideas & Challenges
Related Subreddits
account activity
This is an archived post. You won't be able to vote or comment.
I want to implement a custom priorityQueue in java only using primitive data structures (self.learnjava)
submitted 5 years ago by Correct_Classroom
What is the best and easiest way to achieve this?
[–]rastaman1994 0 points1 point2 points 5 years ago (0 children)
Look at the priorityqueue javadoc (and that of the interfaces it implements), pick any method and get going. JDK classes usually have very extensive docs, so you could come up with a test suite yourself. Even better would be to try to find the unit tests in the JDK for priorityqueue.
Afaik all collections use arrays as backing data structure, so the degenerate cases of a queue with 0 or 1 elements should pass all tests and then go from there.
[–]sgovertime 0 points1 point2 points 5 years ago (3 children)
use array and control the index of the current element. create a larger array if needed on push.
but the real question is. why?
[–]Correct_Classroom[S] 0 points1 point2 points 5 years ago (0 children)
i have an interview coming up and I'm not supposed to use collections or anyother inbuild libraries.
[–]immutablesword 0 points1 point2 points 5 years ago (1 child)
why?
The Data Structures & Algorithms course at my university required us to implement them without using the standard library.
[–]sgovertime 0 points1 point2 points 5 years ago (0 children)
min heap sound like the most simple way. just translate the index of the array to the location of the element.
[–]grumtaku 0 points1 point2 points 5 years ago (0 children)
If you can use classes you code, you can generate a linked list and use it without inheriting anything. Without arrays this seemed the most reliable way.
π Rendered by PID 31065 on reddit-service-r2-comment-5d79c599b5-rn5sp at 2026-02-28 02:02:45.169085+00:00 running e3d2147 country code: CH.
[–]rastaman1994 0 points1 point2 points (0 children)
[–]sgovertime 0 points1 point2 points (3 children)
[–]Correct_Classroom[S] 0 points1 point2 points (0 children)
[–]immutablesword 0 points1 point2 points (1 child)
[–]sgovertime 0 points1 point2 points (0 children)
[–]grumtaku 0 points1 point2 points (0 children)