Wiki

Changes between Version 7 and Version 8 of StandardLibraryExtensionMethods

Show
Ignore:
Timestamp:
05/05/09 04:36:49 (16 years ago)
Author:
Chuck
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • StandardLibraryExtensionMethods

    v7 v8  
    1818 
    1919    extend System.Object 
     20 
     21        def typeOf as System.Type 
     22            """ Using.typeOf is portable between platforms in contrast to CLR .getType and JVM .getClass. """ 
     23            return .getType 
    2024 
    2125        def toTechString as String 
     
    5458    extend IList<of T> 
    5559     
     60        def concated(other as IList<of T>?) as IList<of T> 
     61            """ 
     62            Returns a new list with the contents of this list and the other. 
     63            Does not modify this list or the other. 
     64            The returned list is the same class as the receiver. 
     65            Assumes the receiving type has an initializer that takes a `capacity as int`. 
     66            """ 
     67 
    5668        def get(flexibleIndex as int) as T 
    5769            require 
     
    8092            """ 
    8193     
     94        def numberedDown as KeyValuePair<of int, T>* 
     95            """ 
     96            Returns a stream of pairs of (index, value) in reverse order from 
     97            the end of the list down. 
     98             
     99            Can be used like so: 
     100                for i, value in someList.numberedDown 
     101                    ... 
     102            """ 
     103 
     104        def random as T 
     105            require .count > 0 
     106            return .random(CobraCore.random) 
     107 
     108        def random(r as Random) as T 
     109            require .count > 0 
     110            return this[r.next % .count] 
     111 
     112        def removeLast 
     113            require .count > 0 
     114            ensure .count == old .count - 1 
     115            .removeAt(.count-1) 
     116         
    82117        def reversed as List<of T> 
    83118            ensure