Axel Howind created PDFBOX-5673:
-----------------------------------
Summary: Refactor Stream operations and operations on collections
Key: PDFBOX-5673
URL: https://issues.apache.org/jira/browse/PDFBOX-5673
Project: PDFBox
Issue Type: Bug
Reporter: Axel Howind
Attachments: Refactor_operations_on_collections.patch,
Refactored_stream_operations.patch
*Refactored Stream operations*
In PageDrawer.java, the logic checking visibility conditions was simplified.
The .noneMatch() method was replaced with .allMatch() on the 'visibles' stream.
This altered phraseology from "no elements shouldn't match a condition" to "all
elements should match a condition", enhancing clarity.
In COSArray.java, the use of StreamSupport.stream() to create streams from the
object collection 'objects' was replaced by direct .stream() calls on the
collection.
*Refactored operations on Collections*
Several changes have been made such as using the 'Arrays.fill()' method to
initialize arrays rather than looping through each element. 'List.of()' has
been used to create lists more succinctly and 'Collections.emptyList()' has
replaced 'Collections.<T>emptyList()' for brevity. Conditional removal from
collections has been simplified by directly calling 'collection.remove()'
instead of preceding it with an 'if' statement checking for the presence of an
element. The 'Comparator.comparingInt' lambda expression has been used to
simplify comparisons during sorting.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]