pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1867603 - in /pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox: afm/FontMetrics.java cmap/CMap.java ttf/TTFSubsetter.java util/autodetect/FontFileFinder.java
Date Thu, 26 Sep 2019 19:10:17 GMT
Author: tilman
Date: Thu Sep 26 19:10:16 2019
New Revision: 1867603

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

Modified:
    pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/afm/FontMetrics.java
    pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java
    pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
    pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java

Modified: pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/afm/FontMetrics.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/afm/FontMetrics.java?rev=1867603&r1=1867602&r2=1867603&view=diff
==============================================================================
--- pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/afm/FontMetrics.java
(original)
+++ pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/afm/FontMetrics.java
Thu Sep 26 19:10:16 2019
@@ -699,17 +699,16 @@ public class FontMetrics
         return Collections.unmodifiableList(charMetrics);
     }
 
-    /** Setter for property charMetrics.
+    /**
+     * Setter for property charMetrics.
+     *
      * @param charMetricsValue New value of property charMetrics.
      */
     public void setCharMetrics(List<CharMetric> charMetricsValue)
     {
         charMetrics = charMetricsValue;
         charMetricsMap = new HashMap<>(charMetrics.size());
-        for (CharMetric metric : charMetricsValue)
-        {
-            charMetricsMap.put( metric.getName(), metric );
-        }
+        charMetricsValue.forEach(metric -> charMetricsMap.put(metric.getName(), metric));
     }
 
     /**

Modified: pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java?rev=1867603&r1=1867602&r2=1867603&view=diff
==============================================================================
--- pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java (original)
+++ pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java Thu
Sep 26 19:10:16 2019
@@ -257,12 +257,9 @@ public class CMap
      * 
      * @param cmap The cmap to load mappings from.
      */
-    void useCmap( CMap cmap )
+    void useCmap(CMap cmap)
     {
-        for (CodespaceRange codespaceRange : cmap.codespaceRanges)
-        {
-            addCodespaceRange(codespaceRange);
-        }
+        cmap.codespaceRanges.forEach(this::addCodespaceRange);
         charToUnicode.putAll(cmap.charToUnicode);
         codeToCid.putAll(cmap.codeToCid);
         codeToCidRanges.addAll(cmap.codeToCidRanges);

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=1867603&r1=1867602&r2=1867603&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
Thu Sep 26 19:10:16 2019
@@ -126,10 +126,7 @@ public final class TTFSubsetter
      */
     public void addAll(Set<Integer> unicodeSet)
     {
-        for (int unicode : unicodeSet)
-        {
-            add(unicode);
-        }
+        unicodeSet.forEach(unicode -> add(unicode));
     }
 
     /**

Modified: pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java?rev=1867603&r1=1867602&r2=1867603&view=diff
==============================================================================
--- pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java
(original)
+++ pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/util/autodetect/FontFileFinder.java
Thu Sep 26 19:10:16 2019
@@ -76,10 +76,7 @@ public class FontFileFinder
         }
         List<File> fontDirs = fontDirFinder.find();
         List<URI> results = new ArrayList<>();
-        for (File dir : fontDirs)
-        {
-            walk(dir, results);
-        }
+        fontDirs.forEach(dir -> walk(dir, results));
         return results;
     }
 



Mime
View raw message