• 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
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Confused if this is a Java 8 feature

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

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

 
Marshal
Posts: 66507
251
  • 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: 21822
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu 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 Spring Java
  • 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: 39655
785
Eclipse IDE VI Editor Java
  • 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!
 
Are you okay? You look a little big. Maybe this tiny ad will help:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!