<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>nainaistar</author_name>
  <author_url>https://blog.hatena.ne.jp/nainaistar/</author_url>
  <blog_title>きり丸の技術日記</blog_title>
  <blog_url>https://nainaistar.hatenablog.com/</blog_url>
  <categories>
    <anon>Java</anon>
    <anon>技術</anon>
  </categories>
  <description>結局、願ったとおりに動かなかったので、思考錯誤したときのメモだけ残します。 環境 Java 17 対応 Collections.singletonList(T o)を使用することで、1行でnull許容した配列を作成できます。 動作確認 1行で配列を作成する方法は、List.of(), Arrays.asListのどちらもありますが、NotNull制約があるので、作成できません。 ArrayListはnullも追加可能ですが、初期配列の作成時には使えません。そもそも、初期配列の作成時のパラメータ自体が配列となるため、内部処理にてエラーが発生します。 var sample = new ArrayL…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnainaistar.hatenablog.com%2Fentry%2Fone-liner-nullable-collection-in-java&quot; title=&quot;Javaで1行でNull許容の配列を作りたかった - きり丸の技術日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/n/nainaistar/20230115/20230115215938.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2023-01-23 12:00:00</published>
  <title>Javaで1行でNull許容の配列を作りたかった</title>
  <type>rich</type>
  <url>https://nainaistar.hatenablog.com/entry/one-liner-nullable-collection-in-java</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
