• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

OCP Java SE 11 Developer Study Guide: Which of the following can removeIf() be called on? List/Map/S

 
Greenhorn
Posts: 4
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Among the set of flashcards of the OCP Java SE 11 Developer Study Guide is a card with the question "Which of the following can removeIf() be called on? List/Map/Set" (fc584704.JaSE11PrgISG.f1.070) The card states as the answer only "List".

The removeIf method is however implemented on the Collection interface and therefor also available for the Set implementation.  This card is not yet listed on the "https://www.selikoff.net/ocp11-complete/" page, but I assume the answer should be both List and Set, am I correct?
 
Master Rancher
Posts: 4609
61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you can certainly call removeIf() on a Set, or any Collection, since Java 1.8.
 
author & internet detective
Posts: 41763
885
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't know that. Learned something new today. Have a cow!

I've added it the errata for the Java 11 and Java 17 flashcards.
 
reply
    Bookmark Topic Watch Topic
  • New Topic