I'm watching a talk by Paul Philips :
http://www.youtube.com/watch?v=TS1lpKBMkgg
at 12:48 he says "in Java 8 their views actually work" when comparing Scala and Java
What are Java "views" and what is Scala's equivalent ?
update : Thanks to Daniel's answer I found this article helpful : http://www.scala-lang.org/docu/files/collections-api/collections_42.html
Java 8 is a revolutionary release of the world's #1 development platform. It includes a huge upgrade to the Java programming model and a coordinated evolution of the JVM, Java language, and libraries.
JAVA 8 is a major feature release of JAVA programming language development. Its initial version was released on 18 March 2014. With the Java 8 release, Java provided supports for functional programming, new JavaScript engine, new APIs for date time manipulation, new streaming API, etc.
Introduced in Java 8, the Stream API is used to process collections of objects. A stream is a sequence of objects that supports various methods which can be pipelined to produce the desired result.
Java 8's Stream
is what he means by views. They have two important properties:
map
or filter
calls, and the original collection will still be iterated only once.Scala's equivalent are the various View
collections, which you can get by calling .view
on an existing collection. They do have these properties -- they are the defining properties, after all -- but are plagued with deficiencies and bugs, not to mention a very complex implementation.
Paul has toyed with alternative implementations for it on and off, but it has never been a priority replacing them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With