Operation on List after flatten

大城市里の小女人 提交于 2020-02-06 07:42:13

问题


I perform a flatten operation on a Seq[JsValue] like:

var rows = (response \\ "rows").head.as[List[List[String]]].flatten

to get the following output:

List(AA                     , BB                        , CC                    ,...)

Basically the response I receive from JSON is that way, so extra spaces will be present to the end of all values. What I actually desire for is:

List(AA, BB, CC, ...)

Is it possible to perform any operation before/instead of flatten to get what I want to achieve? I tried a flatMap and the results were not too desirable.

来源:https://stackoverflow.com/questions/57484474/operation-on-list-after-flatten

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!