Pattern Matching for instanceof2023-11-11JavaJava16以降で使用可能Object object = "hoge"; if (object instanceof String s && s.length() > 2) { System.out.println(s); } 参考https://qiita.com/nowokay/items/215769cdcb14d6c5412f#jep-394-pattern-matching-for-instanceof