<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    gr8vyguy@Blogjava

    Groovy讀書(shū)筆記3

    Chapter 04 The collective Groovy datatypes

    Groovy support collection types: ranges, lists and maps.

    how and what

        language expressiveness, 語(yǔ)言的表達(dá)能力
              how much does the code say what, instead of how.


    Range

       1..10       from 1 to 10
       1..<10    from 1 to 9

       10..1     reverse range
     
       the range elements must implement ++, -- and <=>.

       for in range loop

       index -1 means last element.

    Groovy的Command還是要少用,加上括號(hào)吧

    List

         java.util.List

         list = new LinkedList()
         list[0] = 1

        an array from Java to Groovy => converted to a list

        toList()  method, convert a collection to a list

       The list’s getAt() and putAt() are overloaded with the parameters: integer, integers, range, 

       list[0..2] returns a sublist, not a new list, changing in the sublist, change the original list.

       list.inject(initial) { accumulator, index -> f(accumulator, index) }

    duck typing
        as long as something walks like a duck and talks like a duck, 
        we happily treat it as a duck.

    Map

        java.util.Map

       access map
          1. subscript operator map[key], getAt()
          2. dot operator .
          3. method get(), default value

    ConcurrentModificationException

        structurelly changing while iterating, such as list.each

    Copy Semantics and Modify Semantics

        works on a copy of the collection, collect, find, grep
        works in place, e.g. add()

    posted on 2007-12-13 01:26 gr8vyguy 閱讀(525) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Java

    <2007年12月>
    2526272829301
    2345678
    9101112131415
    16171819202122
    23242526272829
    303112345

    導(dǎo)航

    統(tǒng)計(jì)

    公告

  • 轉(zhuǎn)載請(qǐng)注明出處.
  • msn: gr8vyguy at live.com
  • 常用鏈接

    留言簿(9)

    隨筆分類(lèi)(68)

    隨筆檔案(80)

    文章分類(lèi)(1)

    My Open Source Projects

    搜索

    積分與排名

    最新評(píng)論

    主站蜘蛛池模板: 亚洲色大成网站www永久男同| 亚洲gv白嫩小受在线观看| 免费国内精品久久久久影院| 亚洲乱码中文字幕手机在线| 久久精品亚洲日本波多野结衣| 亚洲色www永久网站| 亚洲免费视频网址| 亚洲国语在线视频手机在线| 最近2018中文字幕免费视频| 在线观看91精品国产不卡免费| 亚洲精品成人网站在线观看| 99re6在线视频精品免费| 免费人成在线视频| 国产国拍亚洲精品福利| 亚洲国产精品成人综合色在线婷婷 | 亚洲第一第二第三第四第五第六| 亚洲人成综合网站7777香蕉| 国产精品美女久久久免费 | 大地资源中文在线观看免费版| 日韩成全视频观看免费观看高清| 无码乱人伦一区二区亚洲一| 美丽的姑娘免费观看在线播放| 2020久久精品国产免费| 亚洲日韩精品A∨片无码| 免费无码成人AV在线播放不卡 | 亚洲午夜无码久久久久| 野花香高清视频在线观看免费 | 成人免费夜片在线观看| 国产在线精品一区免费香蕉| 亚洲人成色7777在线观看| 最近中文字幕免费mv在线视频| 亚洲日韩乱码中文无码蜜桃臀网站| 色综合久久精品亚洲国产| 亚洲色偷拍另类无码专区| 69成人免费视频| 亚洲国产精品午夜电影| 亚洲成av人片在线观看天堂无码| 亚洲人成无码网站在线观看| 亚洲综合伊人久久大杳蕉| 2021国产精品成人免费视频| 免费精品国产自产拍在线观看|