<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mamepika</author_name>
  <author_url>https://blog.hatena.ne.jp/mamepika/</author_url>
  <blog_title>まめログ</blog_title>
  <blog_url>https://mamelog.hatenablog.jp/</blog_url>
  <categories>
    <anon>Collection</anon>
    <anon>Java</anon>
    <anon>ArrayList</anon>
    <anon>List</anon>
  </categories>
  <description>Listに格納された要素の中からある条件に一致した要素だけを抽出したい場面がよくあります。 その際にはfor文とif文を使う方法、Stream APIのfilterメソッドを使う方法などがあります。 for文を使って条件に一致した要素を抽出する String型のListから要素を抽出する方法を見てみます。 //コレクション変数の宣言と初期化 List&lt;String&gt; names = new ArrayList&lt;&gt;(); //要素の追加 names.add(&quot;白石麻衣&quot;); names.add(&quot;生田絵梨花&quot;); names.add(&quot;松村沙友理&quot;); コレクションから条件に一致する要素を抽出す…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmamelog.hatenablog.jp%2Fentry%2F2024%2F12%2F05%2F152304&quot; title=&quot;【Java】Listから条件に一致した要素だけを抽出する方法(ArrayList, Stream API) - まめログ&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></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-12-05 15:23:04</published>
  <title>【Java】Listから条件に一致した要素だけを抽出する方法(ArrayList, Stream API)</title>
  <type>rich</type>
  <url>https://mamelog.hatenablog.jp/entry/2024/12/05/152304</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
