pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1867785 - /pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
Date Mon, 30 Sep 2019 17:11:50 GMT
Author: tilman
Date: Mon Sep 30 17:11:50 2019
New Revision: 1867785

URL: http://svn.apache.org/viewvc?rev=1867785&view=rev
Log:
PDFBOX-4071: use jdk8 lambda expressions and streams

Modified:
    pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java

Modified: pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java?rev=1867785&r1=1867784&r2=1867785&view=diff
==============================================================================
--- pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
(original)
+++ pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
Mon Sep 30 17:11:50 2019
@@ -288,14 +288,7 @@ public final class TTFSubsetter
         }
 
         List<NameRecord> nameRecords = name.getNameRecords();
-        int numRecords = 0;
-        for (NameRecord record : nameRecords)
-        {
-            if (shouldCopyNameRecord(record))
-            {
-                numRecords++;
-            }
-        }
+        int numRecords = (int) nameRecords.stream().filter(this::shouldCopyNameRecord).count();
         writeUint16(out, 0);
         writeUint16(out, numRecords);
         writeUint16(out, 2*3 + 2*6 * numRecords);



Mime
View raw message