Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 62887
203
  • 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: 21610
101
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: 39129
723
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!
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!