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

Queue implementation #86

Open
MaximilianHeinrich opened this issue Jan 14, 2025 · 3 comments
Open

Queue implementation #86

MaximilianHeinrich opened this issue Jan 14, 2025 · 3 comments

Comments

@MaximilianHeinrich
Copy link

Please implement the Queue interface. We are required by our teacher to use your tool for CS exams. Our current topic is Data Structure, and it's a little bit awkward and disruptive to create a workaround with Lists and LinkedLists just because there are no JDK 8 features included.

You can find the requests reference and usage

@martin-pabst
Copy link
Owner

martin-pabst commented Jan 14, 2025

According to Javadoc these are the jdk-classes which implement Queue:

AbstractQueue, ArrayBlockingQueue, ArrayDeque, ConcurrentLinkedDeque, 
ConcurrentLinkedQueue, DelayQueue, LinkedBlockingDeque, 
LinkedBlockingQueue, LinkedList, LinkedTransferQueue, PriorityBlockingQueue, 
PriorityQueue, SynchronousQueue

Many of them (like LinkedList) implement Deque which extends Queue.

Which one would you prefer?

Honestly, I'm afraid I'm misunderstanding your question. Maybe you're missing a method of interface Queue?

Do you use the current version of the Online-IDE (https://www.online-ide.de) or the beta-version of the new one (https://new.online-ide.de)?

@DasSharkk
Copy link

We were trying using the new beta-version of the Online-IDE.
We are missing the offer(e) method which is preferable to add(e) as highlighted in the javadoc.
I tried the example @MaximilianHeinrich provided and could solve the errors by using add(e) but it would be nice to use offer(e) especially if you need to use it with capacity-restricted queues.

@martin-pabst
Copy link
Owner

I added offer(e) in https://new.online-ide.de and i'll upload it to www.learnj.de this evening.

Since the online IDE runs in the browser, both its compiler and its runtime library are coded in Javascript (more precisely: Typescript).
The Java standard library is very extensive, so unfortunately I can't implement it completely in typescript.
But if individual classes/methods are needed, I'd be happy to add them.

If you are interested in the details you can find the sourcecode of the new online-ide compiler on github.

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

No branches or pull requests

3 participants