This is an automated email from the ASF dual-hosted git repository. kinow pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 41940939e5f6479708e6c9d52b22874af4d6fc09 Author: Arturo Bernal <[email protected]> AuthorDate: Wed May 12 22:16:23 2021 +0200 [IMAGING-304] Use Comparator combinator --- .../java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java | 2 +- .../commons/imaging/formats/tiff/write/TiffImageWriterLossless.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java index 821aaf6..bfe86fc 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java @@ -24,7 +24,7 @@ import java.util.Comparator; public class IptcRecord { public final IptcType iptcType; private final String value; - public static final Comparator<IptcRecord> COMPARATOR = (e1, e2) -> e1.iptcType.getType() - e2.iptcType.getType(); + public static final Comparator<IptcRecord> COMPARATOR = Comparator.comparingInt(e -> e.iptcType.getType()); public IptcRecord(final IptcType iptcType, final String value) { this.iptcType = iptcType; diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java index b982ea3..3e5ec4a 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java @@ -47,8 +47,8 @@ import org.apache.commons.imaging.formats.tiff.constants.ExifTagConstants; public class TiffImageWriterLossless extends TiffImageWriterBase { private final byte[] exifBytes; - private static final Comparator<TiffElement> ELEMENT_SIZE_COMPARATOR = (e1, e2) -> e1.length - e2.length; - private static final Comparator<TiffOutputItem> ITEM_SIZE_COMPARATOR = (e1, e2) -> e1.getItemLength() - e2.getItemLength(); + private static final Comparator<TiffElement> ELEMENT_SIZE_COMPARATOR = Comparator.comparingInt(e -> e.length); + private static final Comparator<TiffOutputItem> ITEM_SIZE_COMPARATOR = Comparator.comparingInt(TiffOutputItem::getItemLength); public TiffImageWriterLossless(final byte[] exifBytes) { this.exifBytes = exifBytes;
