<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>unageanu</author_name>
  <author_url>https://blog.hatena.ne.jp/unageanu/</author_url>
  <blog_title>うなの日記</blog_title>
  <blog_url>https://unageanu.hatenablog.com/</blog_url>
  <categories>
    <anon>Scala</anon>
  </categories>
  <description>要素を必要になったときに作成して返す仕組みとしてはStreamのほかにIteratorもあります。hasNext(),next()を持つアレです。Java使いにはこっちの方がわかりやすいかも。以下はフィボナッチ数を順に返すイテレータのサンプルです。 Iteratorを継承した無名クラスを作成して、next(),hasNext()をオーバーライドしています。 ScalaByExampleのサンプルがこんな風になってた。 Iteratorはforeachやfilterを実装しているので、forループのジェネレータとして指定できます。 // maxまでのフィボナッチ数を順に返すイテレータを作る関数 …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Funageanu.hatenablog.com%2Fentry%2F20080528%2F1211971215&quot; title=&quot; Iterator - うなの日記&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>2008-05-28 19:40:15</published>
  <title> Iterator</title>
  <type>rich</type>
  <url>https://unageanu.hatenablog.com/entry/20080528/1211971215</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
