使用scala

时间:2017-12-22 12:07:16

标签: java scala

我尝试使用scala分区方法获取D:/work文件夹中的文件和目录数,但我收到错误

import java.io._

val fd = (new File("D:/work/")).listFiles

scala> fd.partition ( x => {case x.isFile() => "FILE"; case x.isDirectory() => "DIR" } )

<console>:28: error: missing parameter type for expanded function
The argument types of an anonymous function must be fully known. (SLS 8.5)
Expected type was: Boolean
       fd.partition ( x => {case x.isFile() => "FILE"; case x.isDirectory() => "DIR" } )
                           ^
<console>:28: error: method isFile is not a case class, nor does it have an unapply/unapplySeq member
       fd.partition ( x => {case x.isFile() => "FILE"; case x.isDirectory() => "DIR" } )
                             ^
<console>:28: error: method isDirectory is not a case class, nor does it have an unapply/unapplySeq member
       fd.partition ( x => {case x.isFile() => "FILE"; case x.isDirectory() => "DIR" } )
                                                              ^

scala>

1 个答案:

答案 0 :(得分:0)

您的代码存在许多问题,表明您应该首先阅读有关scala语法的书(这就是为什么要获得下选票)。

此时似乎没有必要列举你的代码片段的所有错误。像这样的东西会做你想要的:

@media only screen and (min-width:320px) and (max-width:480px)
{
  html, body
  {
    max-width:100%;
    max-height:100%;
    margin: 0px;
    padding: 0px;
    overflow:scroll;
  }
}

如果您想要获取地图而不是元组,则可能是这样的:

<meta name="viewport" content="width=device-width,initial-scale=1.0">