TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Scala wrapper for Java NIO

1 点作者 pathikrit超过 9 年前

1 comment

room271超过 9 年前
I have a (genuine) question about this, as I&#x27;m interested. What is the benefit to supporting so many ways to instantiate a File object:<p><pre><code> val f = File(&quot;&#x2F;User&#x2F;johndoe&#x2F;Documents&quot;) val f1: File = file&quot;&#x2F;User&#x2F;johndoe&#x2F;Documents&quot; val f2: File = root &#x2F; &quot;User&quot; &#x2F; &quot;johndoe&quot; &#x2F; &quot;Documents&quot; val f3: File = home &#x2F; &quot;Documents&quot; val f4: File = new java.io.File(&quot;&#x2F;User&#x2F;johndoe&#x2F;Documents&quot;) val f5: File = &quot;&#x2F;User&quot; &#x2F; &quot;johndoe&quot; &#x2F; &quot;Documents&quot; val f6: File = &quot;&#x2F;User&#x2F;johndoe&#x2F;Documents&quot;.toFile val f7: File = root &#x2F; &quot;User&quot; &#x2F; &quot;johndoe&quot; &#x2F; &quot;Documents&quot; &#x2F; &quot;presentations&quot; &#x2F; `..` </code></pre> Why not just the first one, and string interpolation&#x2F;composition if you need &#x27;root&#x27; or &#x27;home&#x27; ?