score:2
Accepted answer
this is occurring because the last line in your map
lambda is an assignment. assignment expressions evaluate to unit
. what you want is the following:
val pages = (bookfile \ "pages" ).map { pagenode =>
loadpage(pagenode)
}
that should get you a sec[page]
. to convert it to a list[page]
, use the tolist
method on the result.
Source: stackoverflow.com
Related Query
- How to create type aliases to specific Map types in Scala
- Best Scala practice to map Option of Collection of specific type
- Scala get JSON value in a specific data type on map object
- How are Scala collections able to return the correct collection type from a map operation?
- Pattern matching against Scala Map type
- Get the specific simple name of a generic type in Scala
- Scala prohibiting parameterization of a specific type
- Map on HList fails with subtypes of generic type in Scala & Shapeless
- Class type as key in map in Scala
- How to build a Map of lists of map from type safe config in scala
- Scala SortedMap.map method returns non-sorted map when static type is Map
- Scala - How to convert from List of tuples of type (A,B) to type (B,A) using map
- Scala multi-partition a map - type mismatch; Found (A,B) => Boolean required (A,B) => Boolean?
- Scala map containing mix type values
- Unexpected Scala Map type
- Scala map explicit type
- Scala - unexpected type switch from Map to Iterable in for comprehension?
- Scala map with primitive types value type
- Creating a more specific implicit using a structural type with Scala
- How to convert java Map to scala Map of type LinkedHashMap[String,ArrayList[String]]?
- Dependency between Map key and value type parameters in Scala
- Making Scala choose less specific overloaded method in presence of argument of type Nothing
- Return a specific type from for yield in Scala
- Creating three dimensional Array with arbitrary type and map in Scala
- Scala runtime reflections get all the members of a specific type even for inner classes
- How to read from textfile(String type data) map and load data into parquet format(multiple columns with different datatype) in Spark scala dynamically
- scala - constrain generic type to specific types
- extending scala collections for a specific member type
- Scala Type Mismatch Error on Map
- Extracting a value from Scala map of type Map[String,Any], where Any can be a Map itself
More Query from same tag
- Why does Scala allow nested data structures like List or Array
- Scalaz validation and ApplicativeBuilder limits
- Akka Supervision default behavior
- Error while calling an API using akka in scala
- String interpolation with date to string conversion in scala
- Dynamic For Comprehensions
- Create table and alter table dynamically in scala slick
- Understanding How SBT, Scala, SBT-Idea and Play Framework Work Together
- Routing in microservices - stuck with basics
- deserializing models in play 2.2
- akka http with actors : error 503 timeout
- specify partitions size with spark
- Maven and Eclipse Lift Project Errors
- Spark streaming: How to write cumulative output?
- Custom decoder for AWS API Gateway using circe
- SBT project java.io.FileNotFoundException:FileNotFoundException: HADOOP_HOME unset
- If-else expressions in Scala are not aligned well in Intellij IDEA
- Difference between case class with parentheses and without
- Scala on Eclipse gives errors on Map operations
- How make Intellij Idea debug a Play 2.1 app's source code files, instead of project definition only
- Kafka Structured streaming application throwing IllegalStateException when there is a gap in the offset
- Converting a Spark Dataframe to a Scala Map collection list
- How to elegantly extract range of list based on specific criteria?
- scala client/server library for simple game (battleships)
- Getting expected class or object definition when running from Command line in scala but working fine from intelliJ
- r? . the meaning of in scala
- Apache Spark/Scala Bulk inset/update to HBASE
- Returning the same value type, but with success/failure
- Scala parameters for access modifiers?
- how can spray.io work with scala 2.11.1 akka 2.3.2