sdk: Cleanup usage of List.toArray(T[] a)
* The parameter here only has to have the type you want it to return, so creating an array of size > 0 is unnecessary and wasteful Change-Id: I28e490fb6fa3703d7edca21b29d640105072947b
This commit is contained in:
@@ -507,7 +507,7 @@ public final class Profile implements Parcelable, Comparable {
|
||||
* @hide
|
||||
*/
|
||||
public ProfileGroup[] getProfileGroups() {
|
||||
return profileGroups.values().toArray(new ProfileGroup[profileGroups.size()]);
|
||||
return profileGroups.values().toArray(new ProfileGroup[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -566,7 +566,7 @@ public final class Profile implements Parcelable, Comparable {
|
||||
uuids.add(new ParcelUuid(u));
|
||||
}
|
||||
dest.writeInt(1);
|
||||
dest.writeParcelableArray(uuids.toArray(new Parcelable[uuids.size()]), flags);
|
||||
dest.writeParcelableArray(uuids.toArray(new Parcelable[0]), flags);
|
||||
} else {
|
||||
dest.writeInt(0);
|
||||
}
|
||||
@@ -766,7 +766,7 @@ public final class Profile implements Parcelable, Comparable {
|
||||
* @return the secondary uuids for the Profile
|
||||
*/
|
||||
public UUID[] getSecondaryUuids() {
|
||||
return mSecondaryUuids.toArray(new UUID[mSecondaryUuids.size()]);
|
||||
return mSecondaryUuids.toArray(new UUID[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -679,7 +679,7 @@ public final class LineageHardwareManager {
|
||||
remapped.add(r);
|
||||
}
|
||||
}
|
||||
return remapped.toArray(new DisplayMode[remapped.size()]);
|
||||
return remapped.toArray(new DisplayMode[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -567,7 +567,7 @@ public final class Palette {
|
||||
scaledBitmap.getPixels(pixels, 0, width, 0, 0, width, height);
|
||||
|
||||
final ColorCutQuantizer quantizer = new ColorCutQuantizer(pixels, mMaxColors,
|
||||
mFilters.isEmpty() ? null : mFilters.toArray(new Filter[mFilters.size()]));
|
||||
mFilters.isEmpty() ? null : mFilters.toArray(new Filter[0]));
|
||||
|
||||
// If created a new bitmap, recycle it
|
||||
if (scaledBitmap != mBitmap) {
|
||||
|
||||
Reference in New Issue
Block a user