• 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Confused if this is a Java 8 feature  RSS feed

 
Ranch Hand
Posts: 1067
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Are the ".map" and ".filter" new to Java 8?  

 
Marshal
Posts: 61691
193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't var a Java9 feature?
What type is newOverridesCollection? The List interface has neither filter() nor map() methods, but the Stream interface has both, introduced in Java8.
 
Sheriff
Posts: 21463
97
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Isn't var a Java9 feature?


Java 10 even.

But the function keywords make me believe this is not Java, but JavaScript. In JavaScript, arrays have map and filter methods since EcmaScript 5.1 (JavaScript 1.6).
 
William Barnes
Ranch Hand
Posts: 1067
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All the Java examples I can find on the google, which use .map() or .filter() also have .stream(), which is another thing that confused me about this code.  

So I think you are correct, that this is JavaScript.  

Thanks!
 
author & internet detective
Posts: 38906
684
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
var == Java 10

map/filter == Java 8. However, they operate on a stream, not a collection.

So definitely JavaScript!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!