Tue, 13 Jun 2017 16:30:24 -0700
Added tag jdk8u151-b01 for changeset 681ab42e7c73
sundar@1727 | 1 | /* |
sundar@1727 | 2 | * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
sundar@1727 | 3 | * |
sundar@1727 | 4 | * Redistribution and use in source and binary forms, with or without |
sundar@1727 | 5 | * modification, are permitted provided that the following conditions |
sundar@1727 | 6 | * are met: |
sundar@1727 | 7 | * |
sundar@1727 | 8 | * - Redistributions of source code must retain the above copyright |
sundar@1727 | 9 | * notice, this list of conditions and the following disclaimer. |
sundar@1727 | 10 | * |
sundar@1727 | 11 | * - Redistributions in binary form must reproduce the above copyright |
sundar@1727 | 12 | * notice, this list of conditions and the following disclaimer in the |
sundar@1727 | 13 | * documentation and/or other materials provided with the distribution. |
sundar@1727 | 14 | * |
sundar@1727 | 15 | * - Neither the name of Oracle nor the names of its |
sundar@1727 | 16 | * contributors may be used to endorse or promote products derived |
sundar@1727 | 17 | * from this software without specific prior written permission. |
sundar@1727 | 18 | * |
sundar@1727 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
sundar@1727 | 20 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
sundar@1727 | 21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
sundar@1727 | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
sundar@1727 | 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
sundar@1727 | 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
sundar@1727 | 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
sundar@1727 | 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
sundar@1727 | 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
sundar@1727 | 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
sundar@1727 | 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
sundar@1727 | 30 | */ |
sundar@1727 | 31 | |
sundar@1727 | 32 | var Files = java.nio.file.Files; |
sundar@1727 | 33 | var File = java.io.File; |
sundar@1727 | 34 | var d = arguments.length == 0? "." : arguments[0]; |
sundar@1727 | 35 | |
sundar@1727 | 36 | // print total number of lines in all .java files under a |
sundar@1727 | 37 | // given directory (recursively) |
sundar@1727 | 38 | |
sundar@1727 | 39 | print(Files.walk(new File(d).toPath()). |
sundar@1727 | 40 | filter(function(p) p.toString().endsWith(".java")). |
sundar@1727 | 41 | mapToInt(function(p) Files.lines(p).count()).sum()) |