Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • ok, so what can i do to make Queue<String> aQueue = new LinkedList<String>(); work? If I remove the implements linkedList from the queue class will this correct it? I am going to test it in the meanwhile... Ok i just tried it out... it says "incompatible types" ( which is why i put implements.. in in the first place) Commented May 6, 2012 at 14:01
  • cool that solves the one problem... thanks :)... the reason i wanted to have that last snippet was because in my one program i create some linked lists with objects of another class... and i want to be able to copy that linked list over to a queue Commented May 6, 2012 at 14:05
  • @Tim: In the current form it's not possible. If you use the code I posted then there is no relationship between LinkedList and Queue so you cannot assign a LinkedList to a Queue. Furthermore, if you extend LinkedList it's still not correct because then Queue is a specialized linked list and so cannot appear to the left of the assignment. Commented May 6, 2012 at 14:07