Simple Scala pattern for “using/try-with-resources” (Automatic Resource Management)

后端 未结 7 1829
别那么骄傲
别那么骄傲 2020-12-06 00:37

C# has using with the IDisposable interface. Java 7+ has identical functionality with try and the AutoCloseable interface

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-06 01:19

    http://illegalexception.schlichtherle.de/2012/07/19/try-with-resources-for-scala/

    Another implementation, probably more clean from "follow Java specifications" viewpoint, but also fails to support multiple resources

提交回复
热议问题