samples/list_mapreduce.js

changeset 962
ac62e33a99b0
parent 0
b1a7da25b547
     1.1 --- a/samples/list_mapreduce.js	Tue Aug 19 20:43:03 2014 +0100
     1.2 +++ b/samples/list_mapreduce.js	Wed Aug 20 10:25:28 2014 +0200
     1.3 @@ -1,21 +1,21 @@
     1.4  /*
     1.5   * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     1.6 - * 
     1.7 + *
     1.8   * Redistribution and use in source and binary forms, with or without
     1.9   * modification, are permitted provided that the following conditions
    1.10   * are met:
    1.11 - * 
    1.12 + *
    1.13   *   - Redistributions of source code must retain the above copyright
    1.14   *     notice, this list of conditions and the following disclaimer.
    1.15 - * 
    1.16 + *
    1.17   *   - Redistributions in binary form must reproduce the above copyright
    1.18   *     notice, this list of conditions and the following disclaimer in the
    1.19   *     documentation and/or other materials provided with the distribution.
    1.20 - * 
    1.21 + *
    1.22   *   - Neither the name of Oracle nor the names of its
    1.23   *     contributors may be used to endorse or promote products derived
    1.24   *     from this software without specific prior written permission.
    1.25 - * 
    1.26 + *
    1.27   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    1.28   * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1.29   * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    1.30 @@ -31,9 +31,9 @@
    1.31  
    1.32  // Usage: jjs list_mapreduce.js
    1.33  
    1.34 -// Many Array.prototype functions such as map, 
    1.35 +// Many Array.prototype functions such as map,
    1.36  // filter, reduce, reduceRight, every, some are generic.
    1.37 -// These functions accept ECMAScript array as well as 
    1.38 +// These functions accept ECMAScript array as well as
    1.39  // many array-like objects including java.util.ArrayLists.
    1.40  // So, you can do map/filter/reduce with Java streams or
    1.41  // you can also use Array.prototype functions as below.
    1.42 @@ -81,6 +81,6 @@
    1.43  // print sum of squares of the random numbers
    1.44  print("Square sum:",
    1.45      reduce.call(
    1.46 -        map.call(list, function(x) x*x), 
    1.47 +        map.call(list, function(x) x*x),
    1.48          function(x, y) x + y)
    1.49  );

mercurial