Skip to content

Commit

Permalink
Use Collections.singletonList instead of Arrays.asList with single item.
Browse files Browse the repository at this point in the history
  • Loading branch information
drewnoakes committed Jul 1, 2015
1 parent 8bfc2e9 commit 4cb5200
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Source/com/drew/metadata/adobe/AdobeJpegReader.java
Expand Up @@ -30,7 +30,7 @@
import com.drew.metadata.Metadata;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;

/**
* Decodes Adobe formatted data stored in JPEG files, normally in the APPE (App14) segment.
Expand All @@ -45,7 +45,7 @@ public class AdobeJpegReader implements JpegSegmentMetadataReader
@NotNull
public Iterable<JpegSegmentType> getSegmentTypes()
{
return Arrays.asList(JpegSegmentType.APPE);
return Collections.singletonList(JpegSegmentType.APPE);
}

public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType)
Expand Down
4 changes: 2 additions & 2 deletions Source/com/drew/metadata/exif/ExifReader.java
Expand Up @@ -30,7 +30,7 @@
import com.drew.metadata.Metadata;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;

/**
* Decodes Exif binary data, populating a {@link Metadata} object with tag values in {@link ExifSubIFDDirectory},
Expand Down Expand Up @@ -59,7 +59,7 @@ public void setStoreThumbnailBytes(boolean storeThumbnailBytes)
@NotNull
public Iterable<JpegSegmentType> getSegmentTypes()
{
return Arrays.asList(JpegSegmentType.APP1);
return Collections.singletonList(JpegSegmentType.APP1);
}

public void readJpegSegments(@NotNull final Iterable<byte[]> segments, @NotNull final Metadata metadata, @NotNull final JpegSegmentType segmentType)
Expand Down
4 changes: 2 additions & 2 deletions Source/com/drew/metadata/icc/IccReader.java
Expand Up @@ -31,8 +31,8 @@
import com.drew.metadata.MetadataReader;

import java.io.IOException;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.TimeZone;

/**
Expand All @@ -55,7 +55,7 @@ public class IccReader implements JpegSegmentMetadataReader, MetadataReader
@NotNull
public Iterable<JpegSegmentType> getSegmentTypes()
{
return Arrays.asList(JpegSegmentType.APP2);
return Collections.singletonList(JpegSegmentType.APP2);
}

public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType)
Expand Down
4 changes: 2 additions & 2 deletions Source/com/drew/metadata/iptc/IptcReader.java
Expand Up @@ -29,7 +29,7 @@
import com.drew.metadata.Metadata;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;

/**
Expand Down Expand Up @@ -59,7 +59,7 @@ public class IptcReader implements JpegSegmentMetadataReader
@NotNull
public Iterable<JpegSegmentType> getSegmentTypes()
{
return Arrays.asList(JpegSegmentType.APPD);
return Collections.singletonList(JpegSegmentType.APPD);
}

public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType)
Expand Down
4 changes: 2 additions & 2 deletions Source/com/drew/metadata/jfif/JfifReader.java
Expand Up @@ -29,7 +29,7 @@
import com.drew.metadata.MetadataReader;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;

/**
* Reader for JFIF data, found in the APP0 JPEG segment.
Expand All @@ -48,7 +48,7 @@ public class JfifReader implements JpegSegmentMetadataReader, MetadataReader
@NotNull
public Iterable<JpegSegmentType> getSegmentTypes()
{
return Arrays.asList(JpegSegmentType.APP0);
return Collections.singletonList(JpegSegmentType.APP0);
}

public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType)
Expand Down
4 changes: 2 additions & 2 deletions Source/com/drew/metadata/jfxx/JfxxReader.java
Expand Up @@ -29,7 +29,7 @@
import com.drew.metadata.MetadataReader;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;

/**
* Reader for JFXX (JFIF extensions) data, found in the APP0 JPEG segment.
Expand All @@ -48,7 +48,7 @@ public class JfxxReader implements JpegSegmentMetadataReader, MetadataReader
@NotNull
public Iterable<JpegSegmentType> getSegmentTypes()
{
return Arrays.asList(JpegSegmentType.APP0);
return Collections.singletonList(JpegSegmentType.APP0);
}

public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType)
Expand Down
4 changes: 2 additions & 2 deletions Source/com/drew/metadata/jpeg/JpegCommentReader.java
Expand Up @@ -25,7 +25,7 @@
import com.drew.lang.annotations.NotNull;
import com.drew.metadata.Metadata;

import java.util.Arrays;
import java.util.Collections;

/**
* Decodes the comment stored within JPEG files, populating a {@link Metadata} object with tag values in a
Expand All @@ -38,7 +38,7 @@ public class JpegCommentReader implements JpegSegmentMetadataReader
@NotNull
public Iterable<JpegSegmentType> getSegmentTypes()
{
return Arrays.asList(JpegSegmentType.COM);
return Collections.singletonList(JpegSegmentType.COM);
}

public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType)
Expand Down
4 changes: 2 additions & 2 deletions Source/com/drew/metadata/photoshop/DuckyReader.java
Expand Up @@ -28,7 +28,7 @@
import com.drew.metadata.Metadata;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;

/**
* Reads Photoshop "ducky" segments, created during Save-for-Web.
Expand All @@ -43,7 +43,7 @@ public class DuckyReader implements JpegSegmentMetadataReader
@NotNull
public Iterable<JpegSegmentType> getSegmentTypes()
{
return Arrays.asList(JpegSegmentType.APPC);
return Collections.singletonList(JpegSegmentType.APPC);
}

public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType)
Expand Down
8 changes: 5 additions & 3 deletions Source/com/drew/metadata/photoshop/PhotoshopReader.java
Expand Up @@ -23,15 +23,17 @@
import com.drew.imaging.ImageProcessingException;
import com.drew.imaging.jpeg.JpegSegmentMetadataReader;
import com.drew.imaging.jpeg.JpegSegmentType;
import com.drew.lang.*;
import com.drew.lang.ByteArrayReader;
import com.drew.lang.SequentialByteArrayReader;
import com.drew.lang.SequentialReader;
import com.drew.lang.annotations.NotNull;
import com.drew.metadata.Metadata;
import com.drew.metadata.exif.ExifReader;
import com.drew.metadata.icc.IccReader;
import com.drew.metadata.iptc.IptcReader;
import com.drew.metadata.xmp.XmpReader;

import java.util.Arrays;
import java.util.Collections;

/**
* Reads metadata created by Photoshop and stored in the APPD segment of JPEG files.
Expand All @@ -49,7 +51,7 @@ public class PhotoshopReader implements JpegSegmentMetadataReader
@NotNull
public Iterable<JpegSegmentType> getSegmentTypes()
{
return Arrays.asList(JpegSegmentType.APPD);
return Collections.singletonList(JpegSegmentType.APPD);
}

public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType)
Expand Down
4 changes: 2 additions & 2 deletions Source/com/drew/metadata/xmp/XmpReader.java
Expand Up @@ -31,8 +31,8 @@
import com.drew.lang.annotations.NotNull;
import com.drew.metadata.Metadata;

import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;

/**
* Extracts XMP data from a JPEG header segment.
Expand Down Expand Up @@ -70,7 +70,7 @@ public class XmpReader implements JpegSegmentMetadataReader
@NotNull
public Iterable<JpegSegmentType> getSegmentTypes()
{
return Arrays.asList(JpegSegmentType.APP1);
return Collections.singletonList(JpegSegmentType.APP1);
}

/**
Expand Down

0 comments on commit 4cb5200

Please sign in to comment.