LoginSignup
1
1

More than 5 years have passed since last update.

ファイルパスの操作

Last updated at Posted at 2016-12-07

ファイルのパスをつなげるようなときに、もちろんStringでつなぐとかは論外として、、いままでは

File base = new File("/tmp/base");
new File(new File(base, "more1"), "more2");

こんな風にくるんでくるんで、みたいな処理をしていたのが、

Paths.get("/tmp/base","more1","more2").toFile();

このように可変長引数を使ってつなげるようになりました。いまどきの言語だと当たり前なんですけど、Javaもキレイになりました。。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1