• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Selikoff/Boyarsky OCP Chpater 3 Question 19 Answers  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

In the answers you say that you can assign the LinkedList to a Queue variable in this example code:


The answer says that you can assign it to a Queue variable and that Queue has an overloaded remove method that takes an object in to remove. 1 would be autoboxed to an Integer then cast to Object, and return false because it does not exist in the LinkedList. However when I look at the java.util.Queue javadoc, there is no such overloaded method: https://docs.oracle.com/javase/8/docs/api/java/util/Queue.html. It only shows remove() that takes no parameters, and removes only the first element in the queue. Am I misunderstanding something? Thank you!
 
Marshal
Posts: 64166
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the whole of the method summary. Underneath where you looked it says,

Methods inherited from interface java.util.Collection

where there is a second remove() method, taking Object as its parameter.
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!