开发者社区 问答 正文

scala List remove总是报错?报错

源码:

val thrill =List("wewe","sds","s")
println(thrill);
println(thrill.remove(s=> s.length ==4))

 

异常List1.scala:4: error: value remove is not a member of List[String]

println(thrill.remove(s=> s.length ==4))
one error found

 

 

刚学习scala 希望大神讲解一下,其它方法可以用,就这个remove不行

展开
收起
爱吃鱼的程序员 2020-06-14 22:44:27 565 分享
分享
版权
举报
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    println(thrill.filterNot(s=>s.length==4))


    改成这样就好了。
    scala用的多吗

    2020-06-14 22:44:43 举报
    赞同 评论

    评论

    全部评论 (0)

    登录后可评论
问答分类:
问答地址: