Remove type duplicates in constructors (Java 1.7)

This commit is contained in:
Daniel Martí
2015-08-21 17:35:03 -07:00
parent 41dd23aeeb
commit 283408b922
35 changed files with 77 additions and 80 deletions
@@ -18,7 +18,7 @@ public class DialogHelper {
private static final String TAG = "DialogHelper";
public static void showDeleteConversationDialog(MainActivity context, long threadId) {
List<Long> threadIds = new ArrayList<Long>();
List<Long> threadIds = new ArrayList<>();
threadIds.add(threadId);
showDeleteConversationDialog(context, threadIds);
}
@@ -67,7 +67,7 @@ abstract class BackgroundLoaderManager {
BackgroundLoaderManager(Context context) {
mPendingTaskUris = new HashSet<Uri>();
mCallbacks = new HashMap<Uri, Set<ItemLoadedCallback>>();
final LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>();
final LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<>();
final int poolSize = MAX_THREADS;
mExecutor = new ThreadPoolExecutor(
poolSize, poolSize, 5, TimeUnit.SECONDS, queue,
@@ -43,10 +43,9 @@ public class DraftCache {
// before deleting any empty threads from the db.
private final Object mSavingDraftLock = new Object();
private HashSet<Long> mDraftSet = new HashSet<Long>(4);
private HashSet<Long> mDraftSet = new HashSet<>(4);
private final Object mDraftSetLock = new Object();
private final HashSet<OnDraftChangedListener> mChangeListeners
= new HashSet<OnDraftChangedListener>(1);
private final HashSet<OnDraftChangedListener> mChangeListeners = new HashSet<>(1);
private final Object mChangeListenersLock = new Object();
public interface OnDraftChangedListener {
@@ -95,7 +94,7 @@ public class DraftCache {
log("rebuildCache");
}
HashSet<Long> newDraftSet = new HashSet<Long>();
HashSet<Long> newDraftSet = new HashSet<>();
Cursor cursor = SqliteWrapper.query(
mContext,
@@ -103,7 +103,7 @@ public class MessageUtils {
// anything ever delete from the mmssms.db canonical_addresses
// table? Nothing that I could find.
private static final Map<String, String> sRecipientAddress =
new ConcurrentHashMap<String, String>(20 /* initial capacity */);
new ConcurrentHashMap<>(20 /* initial capacity */);
// When we pass a video record duration to the video recorder, use one of these values.
private static final int[] sVideoDuration =
@@ -795,7 +795,7 @@ public class MessageUtils {
return;
}
final Map<String, String> map = new HashMap<String, String>();
final Map<String, String> map = new HashMap<>();
try {
if (c.getCount() == 0) {
if (callback != null) {
@@ -889,7 +889,7 @@ public class MessageUtils {
public static ArrayList<String> extractUris(URLSpan[] spans) {
int size = spans.length;
ArrayList<String> accumulator = new ArrayList<String>();
ArrayList<String> accumulator = new ArrayList<>();
for (int i = 0; i < size; i++) {
accumulator.add(spans[i].getURL());
@@ -41,7 +41,7 @@ import java.util.List;
public class AndroidCustomField extends VCardProperty {
private String type;
private boolean dir;
private List<String> values = new ArrayList<String>();
private List<String> values = new ArrayList<>();
/**
* Creates an "item" field.
@@ -89,7 +89,7 @@ public class ContactOperations {
public void insertContact(VCard vcard) throws RemoteException, OperationApplicationException {
// TODO handle Raw properties - Raw properties include various extension which start with "X-" like X-ASSISTANT, X-AIM, X-SPOUSE
List<NonEmptyContentValues> contentValues = new ArrayList<NonEmptyContentValues>();
List<NonEmptyContentValues> contentValues = new ArrayList<>();
contentValues.add(account);
convertName(contentValues, vcard);
@@ -113,7 +113,7 @@ public class ContactOperations {
convertPhotos(contentValues, vcard);
convertOrganization(contentValues, vcard);
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(contentValues.size());
ArrayList<ContentProviderOperation> operations = new ArrayList<>(contentValues.size());
for (NonEmptyContentValues values : contentValues) {
ContentValues cv = values.getContentValues();
if (cv.size() == 0) {
@@ -488,7 +488,7 @@ public class ContactOperations {
* value is the list of properties that belong to that group
*/
private <T extends VCardProperty> Map<String, List<T>> orderPropertiesByGroup(List<T> properties) {
Map<String, List<T>> groupedProperties = new HashMap<String, List<T>>();
Map<String, List<T>> groupedProperties = new HashMap<>();
for (T property : properties) {
String group = property.getGroup();
@@ -49,7 +49,7 @@ import java.util.Map;
public class DataMappings {
private static final Map<TelephoneType, Integer> phoneTypeMappings;
static {
Map<TelephoneType, Integer> m = new HashMap<TelephoneType, Integer>();
Map<TelephoneType, Integer> m = new HashMap<>();
m.put(TelephoneType.BBS, ContactsContract.CommonDataKinds.Phone.TYPE_CUSTOM);
m.put(TelephoneType.CAR, ContactsContract.CommonDataKinds.Phone.TYPE_CAR);
m.put(TelephoneType.CELL, ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE);
@@ -70,7 +70,7 @@ public class DataMappings {
private static final Map<String, Integer> websiteTypeMappings;
static {
Map<String, Integer> m = new HashMap<String, Integer>();
Map<String, Integer> m = new HashMap<>();
m.put("home", ContactsContract.CommonDataKinds.Website.TYPE_HOME);
m.put("work", ContactsContract.CommonDataKinds.Website.TYPE_WORK);
m.put("homepage", ContactsContract.CommonDataKinds.Website.TYPE_HOMEPAGE);
@@ -80,7 +80,7 @@ public class DataMappings {
private static final Map<EmailType, Integer> emailTypeMappings;
static {
Map<EmailType, Integer> m = new HashMap<EmailType, Integer>();
Map<EmailType, Integer> m = new HashMap<>();
m.put(EmailType.HOME, ContactsContract.CommonDataKinds.Email.TYPE_HOME);
m.put(EmailType.WORK, ContactsContract.CommonDataKinds.Email.TYPE_WORK);
emailTypeMappings = Collections.unmodifiableMap(m);
@@ -88,7 +88,7 @@ public class DataMappings {
private static final Map<AddressType, Integer> addressTypeMappings;
static {
Map<AddressType, Integer> m = new HashMap<AddressType, Integer>();
Map<AddressType, Integer> m = new HashMap<>();
m.put(AddressType.HOME, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_HOME);
m.put(AddressType.get("business"), ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK);
m.put(AddressType.WORK, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK);
@@ -98,7 +98,7 @@ public class DataMappings {
private static final Map<String, Integer> abRelatedNamesMappings;
static {
Map<String, Integer> m = new HashMap<String, Integer>();
Map<String, Integer> m = new HashMap<>();
m.put("father", ContactsContract.CommonDataKinds.Relation.TYPE_FATHER);
m.put("spouse", ContactsContract.CommonDataKinds.Relation.TYPE_SPOUSE);
m.put("mother", ContactsContract.CommonDataKinds.Relation.TYPE_MOTHER);
@@ -114,7 +114,7 @@ public class DataMappings {
private static final Map<String, Integer> abDateMappings;
static {
Map<String, Integer> m = new HashMap<String, Integer>();
Map<String, Integer> m = new HashMap<>();
m.put("anniversary", ContactsContract.CommonDataKinds.Event.TYPE_ANNIVERSARY);
m.put("other", ContactsContract.CommonDataKinds.Event.TYPE_OTHER);
abDateMappings = Collections.unmodifiableMap(m);
@@ -122,7 +122,7 @@ public class DataMappings {
private static final Map<String, Integer> imPropertyNameMappings;
static{
Map<String, Integer> m = new HashMap<String, Integer>();
Map<String, Integer> m = new HashMap<>();
m.put("X-AIM", ContactsContract.CommonDataKinds.Im.PROTOCOL_AIM);
m.put("X-ICQ", ContactsContract.CommonDataKinds.Im.PROTOCOL_ICQ);
m.put("X-QQ", ContactsContract.CommonDataKinds.Im.PROTOCOL_ICQ);
@@ -139,7 +139,7 @@ public class DataMappings {
private static final Map<String, Integer> imProtocolMappings;
static{
Map<String, Integer> m = new HashMap<String, Integer>();
Map<String, Integer> m = new HashMap<>();
m.put("aim", ContactsContract.CommonDataKinds.Im.PROTOCOL_AIM);
m.put("icq", ContactsContract.CommonDataKinds.Im.PROTOCOL_ICQ);
m.put("msn", ContactsContract.CommonDataKinds.Im.PROTOCOL_MSN);
@@ -68,7 +68,7 @@ public class Contact {
}
};
private final static HashSet<UpdateListener> mListeners = new HashSet<UpdateListener>();
private final static HashSet<UpdateListener> mListeners = new HashSet<>();
private long mContactMethodId; // Id in phone or email Uri returned by provider of current
// Contact, -1 is invalid. e.g. contact method id is 20 when
@@ -468,8 +468,7 @@ public class Contact {
private final Context mContext;
private final HashMap<String, ArrayList<Contact>> mContactsHash =
new HashMap<String, ArrayList<Contact>>();
private final HashMap<String, ArrayList<Contact>> mContactsHash = new HashMap<>();
private ContactsCache(Context context) {
mContext = context;
@@ -640,14 +639,14 @@ public class Contact {
return null;
}
List<Contact> entries = new ArrayList<Contact>();
List<Contact> entries = new ArrayList<>();
try {
while (cursor.moveToNext()) {
Contact entry = new Contact(cursor.getString(PHONE_NUMBER_COLUMN),
cursor.getString(CONTACT_NAME_COLUMN));
fillPhoneTypeContact(entry, cursor);
ArrayList<Contact> value = new ArrayList<Contact>();
ArrayList<Contact> value = new ArrayList<>();
value.add(entry);
// Put the result in the cache.
mContactsHash.put(key(entry.mNumber, sStaticKeyBuffer), value);
@@ -125,7 +125,7 @@ public class ContactList extends ArrayList<Contact> {
}
public String[] getNumbers(boolean scrubForMmsAddress) {
List<String> numbers = new ArrayList<String>();
List<String> numbers = new ArrayList<>();
String number;
for (Contact c : this) {
number = c.getNumber();
@@ -607,7 +607,7 @@ public class Conversation {
}
private static long getOrCreateThreadId(Context context, ContactList list) {
HashSet<String> recipients = new HashSet<String>();
HashSet<String> recipients = new HashSet<>();
Contact cacheContact = null;
for (Contact c : list) {
cacheContact = Contact.get(c.getNumber(), false);
@@ -1224,7 +1224,7 @@ public class Conversation {
// Keep track of what threads are now on disk so we
// can discard anything removed from the cache.
HashSet<Long> threadsOnDisk = new HashSet<Long>();
HashSet<Long> threadsOnDisk = new HashSet<>();
// Query for all conversations.
Cursor c = context.getContentResolver().query(sAllThreadsUri,
@@ -96,7 +96,7 @@ public class RecipientIdCache {
public static List<Entry> getAddresses(String spaceSepIds) {
synchronized (sInstance) {
List<Entry> numbers = new ArrayList<Entry>();
List<Entry> numbers = new ArrayList<>();
String[] ids = spaceSepIds.split(" ");
for (String id : ids) {
long longId;
@@ -45,7 +45,7 @@ class ExifData {
private final IfdData[] mIfdDatas = new IfdData[IfdId.TYPE_IFD_COUNT];
private byte[] mThumbnail;
private final ArrayList<byte[]> mStripBytes = new ArrayList<byte[]>();
private final ArrayList<byte[]> mStripBytes = new ArrayList<>();
private final ByteOrder mByteOrder;
ExifData(ByteOrder order) {
@@ -253,7 +253,7 @@ class ExifData {
* are none.
*/
protected List<ExifTag> getAllTags() {
ArrayList<ExifTag> ret = new ArrayList<ExifTag>();
ArrayList<ExifTag> ret = new ArrayList<>();
for (IfdData d : mIfdDatas) {
if (d != null) {
ExifTag[] tags = d.getAllTags();
@@ -283,7 +283,7 @@ class ExifData {
if (tags == null) {
return null;
}
ArrayList<ExifTag> ret = new ArrayList<ExifTag>(tags.length);
ArrayList<ExifTag> ret = new ArrayList<>(tags.length);
for (ExifTag t : tags) {
ret.add(t);
}
@@ -298,7 +298,7 @@ class ExifData {
* are none.
*/
protected List<ExifTag> getAllTagsForTagId(short tag) {
ArrayList<ExifTag> ret = new ArrayList<ExifTag>();
ArrayList<ExifTag> ret = new ArrayList<>();
for (IfdData d : mIfdDatas) {
if (d != null) {
ExifTag t = d.getTag(tag);
@@ -322,7 +322,7 @@ public class ExifInterface {
* Tags that contain offset markers. These are included in the banned
* defines.
*/
private static HashSet<Short> sOffsetTags = new HashSet<Short>();
private static HashSet<Short> sOffsetTags = new HashSet<>();
static {
sOffsetTags.add(getTrueTagKey(TAG_GPS_IFD));
sOffsetTags.add(getTrueTagKey(TAG_EXIF_IFD));
@@ -334,7 +334,7 @@ public class ExifInterface {
/**
* Tags with definitions that cannot be overridden (banned defines).
*/
protected static HashSet<Short> sBannedDefines = new HashSet<Short>(sOffsetTags);
protected static HashSet<Short> sBannedDefines = new HashSet<>(sOffsetTags);
static {
sBannedDefines.add(getTrueTagKey(TAG_NULL));
sBannedDefines.add(getTrueTagKey(TAG_JPEG_INTERCHANGE_FORMAT_LENGTH));
@@ -2341,7 +2341,7 @@ public class ExifInterface {
protected static int[] getAllowedIfdsFromInfo(int info) {
int ifdFlags = getAllowedIfdFlagsFromInfo(info);
int[] ifds = IfdData.getIfds();
ArrayList<Integer> l = new ArrayList<Integer>();
ArrayList<Integer> l = new ArrayList<>();
for (int i = 0; i < IfdId.TYPE_IFD_COUNT; i++) {
int flag = (ifdFlags >> i) & 1;
if (flag == 1) {
@@ -30,7 +30,7 @@ class ExifModifier {
public static final boolean DEBUG = false;
private final ByteBuffer mByteBuffer;
private final ExifData mTagToModified;
private final List<TagOffset> mTagOffsets = new ArrayList<TagOffset>();
private final List<TagOffset> mTagOffsets = new ArrayList<>();
private final ExifInterface mInterface;
private int mOffsetBase;
@@ -241,7 +241,7 @@ class ExifOutputStream extends FilterOutputStream {
}
private ArrayList<ExifTag> stripNullValueTags(ExifData data) {
ArrayList<ExifTag> nullTags = new ArrayList<ExifTag>();
ArrayList<ExifTag> nullTags = new ArrayList<>();
for(ExifTag t : data.getAllTags()) {
if (t.getValue() == null && !ExifInterface.isOffsetTag(t.getTagId())) {
data.removeTag(t.getTagId(), t.getIfd());
@@ -176,7 +176,7 @@ public class ExifParser {
private static final short TAG_STRIP_BYTE_COUNTS = ExifInterface
.getTrueTagKey(ExifInterface.TAG_STRIP_BYTE_COUNTS);
private final TreeMap<Integer, Object> mCorrespondingEvent = new TreeMap<Integer, Object>();
private final TreeMap<Integer, Object> mCorrespondingEvent = new TreeMap<>();
private boolean isIfdRequested(int ifdType) {
switch (ifdType) {
@@ -28,7 +28,7 @@ import java.util.Map;
class IfdData {
private final int mIfdId;
private final Map<Short, ExifTag> mExifTags = new HashMap<Short, ExifTag>();
private final Map<Short, ExifTag> mExifTags = new HashMap<>();
private int mOffsetToNextIfd = 0;
private static final int[] sIfds = {
IfdId.TYPE_IFD_0, IfdId.TYPE_IFD_1, IfdId.TYPE_IFD_EXIF,
@@ -739,7 +739,7 @@ public class IabHelper {
public void consumeAsync(Purchase purchase, OnConsumeFinishedListener listener) {
checkNotDisposed();
checkSetupDone("consume");
List<Purchase> purchases = new ArrayList<Purchase>();
List<Purchase> purchases = new ArrayList<>();
purchases.add(purchase);
consumeAsyncInternal(purchases, listener, null);
}
@@ -911,7 +911,7 @@ public class IabHelper {
int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
throws RemoteException, JSONException {
logDebug("Querying SKU details.");
ArrayList<String> skuList = new ArrayList<String>();
ArrayList<String> skuList = new ArrayList<>();
skuList.addAll(inv.getAllOwnedSkus(itemType));
if (moreSkus != null) {
for (String sku : moreSkus) {
@@ -963,7 +963,7 @@ public class IabHelper {
(new Thread(new Runnable() {
@Override
public void run() {
final List<IabResult> results = new ArrayList<IabResult>();
final List<IabResult> results = new ArrayList<>();
for (Purchase purchase : purchases) {
try {
consume(purchase);
@@ -25,8 +25,8 @@ import java.util.Map;
* An Inventory is returned by such methods as {@link IabHelper#queryInventory}.
*/
public class Inventory {
Map<String,SkuDetails> mSkuMap = new HashMap<String,SkuDetails>();
Map<String,Purchase> mPurchaseMap = new HashMap<String,Purchase>();
Map<String,SkuDetails> mSkuMap = new HashMap<>();
Map<String,Purchase> mPurchaseMap = new HashMap<>();
Inventory() { }
@@ -69,7 +69,7 @@ public class Inventory {
/** Returns a list of all owned product IDs of a given type */
List<String> getAllOwnedSkus(String itemType) {
List<String> result = new ArrayList<String>();
List<String> result = new ArrayList<>();
for (Purchase p : mPurchaseMap.values()) {
if (p.getItemType().equals(itemType)) result.add(p.getSku());
}
@@ -214,8 +214,8 @@ public class Transaction {
PendingIntent deliveredPI = PendingIntent.getBroadcast(context, messageId, new Intent(SMS_DELIVERED)
.putExtra("message_uri", messageUri == null ? "" : messageUri.toString()), PendingIntent.FLAG_UPDATE_CURRENT);
ArrayList<PendingIntent> sPI = new ArrayList<PendingIntent>();
ArrayList<PendingIntent> dPI = new ArrayList<PendingIntent>();
ArrayList<PendingIntent> sPI = new ArrayList<>();
ArrayList<PendingIntent> dPI = new ArrayList<>();
String body = text;
@@ -336,7 +336,7 @@ public class Transaction {
address = address.trim();
// create the parts to send
ArrayList<MMSPart> data = new ArrayList<MMSPart>();
ArrayList<MMSPart> data = new ArrayList<>();
for (int i = 0; i < image.length; i++) {
// turn bitmap into byte array to be stored
@@ -762,7 +762,7 @@ public class Transaction {
@Override
public void run() {
List<APN> apns = new ArrayList<APN>();
List<APN> apns = new ArrayList<>();
try {
APN apn = new APN(settings.getMmsc(), settings.getPort(), settings.getProxy());
@@ -1072,7 +1072,7 @@ public class Transaction {
try {
Uri destUri = Uri.parse("content://mms");
Set<String> recipients = new HashSet<String>();
Set<String> recipients = new HashSet<>();
recipients.addAll(Arrays.asList(to));
long thread_id = Utils.getOrCreateThreadId(context, recipients);
@@ -281,7 +281,7 @@ public class Utils {
* @return the thread_id to use in the database
*/
public static long getOrCreateThreadId(Context context, String recipient) {
Set<String> recipients = new HashSet<String>();
Set<String> recipients = new HashSet<>();
recipients.add(recipient);
return getOrCreateThreadId(context, recipients);
@@ -60,13 +60,13 @@ public class ImageModel extends RegionMediaModel {
* into one of these content types before being sent over MMS.
*/
private static final Set<String> SUPPORTED_MMS_IMAGE_CONTENT_TYPES =
new HashSet<String>(Arrays.asList(new String[] {
new HashSet<>(Arrays.asList(new String[] {
"image/jpeg",
}));
private int mWidth;
private int mHeight;
private SoftReference<Bitmap> mFullSizeBitmapCache = new SoftReference<Bitmap>(null);
private SoftReference<Bitmap> mFullSizeBitmapCache = new SoftReference<>(null);
private ItemLoadedFuture mItemLoadedFuture;
public ImageModel(Context context, Uri uri, RegionModel region)
@@ -141,7 +141,7 @@ public class LayoutModel extends Model {
* Get all regions except root-layout. The result is READ-ONLY.
*/
public ArrayList<RegionModel> getRegions() {
ArrayList<RegionModel> regions = new ArrayList<RegionModel>();
ArrayList<RegionModel> regions = new ArrayList<>();
if (mImageRegion != null) {
regions.add(mImageRegion);
}
@@ -132,7 +132,7 @@ public class MediaModelFactory {
if (allContentIDs) {
// Now, build a list of long IDs, sort them, and remove the duplicates.
ArrayList<Long> cids = new ArrayList<Long>();
ArrayList<Long> cids = new ArrayList<>();
for (String _src : srcs) {
cids.add(getContentId(_src));
}
@@ -40,7 +40,7 @@ public class SlideModel extends Model implements List<MediaModel>, EventListener
private static final boolean LOCAL_LOGV = DEBUG ? Config.LOGD : Config.LOGV;
private static final int DEFAULT_SLIDE_DURATION = 5000;
private final ArrayList<MediaModel> mMedia = new ArrayList<MediaModel>();
private final ArrayList<MediaModel> mMedia = new ArrayList<>();
private MediaModel mText;
private MediaModel mImage;
@@ -127,7 +127,7 @@ public class SlideshowModel extends Model
null, 0, 0, w, h);
// Create region models.
ArrayList<RegionModel> regions = new ArrayList<RegionModel>();
ArrayList<RegionModel> regions = new ArrayList<>();
NodeList nlRegions = sle.getRegions();
int regionsNum = nlRegions.getLength();
@@ -144,7 +144,7 @@ public class SlideshowModel extends Model
SMILElement docBody = document.getBody();
NodeList slideNodes = docBody.getChildNodes();
int slidesNum = slideNodes.getLength();
ArrayList<SlideModel> slides = new ArrayList<SlideModel>(slidesNum);
ArrayList<SlideModel> slides = new ArrayList<>(slidesNum);
int totalMessageSize = 0;
for (int i = 0; i < slidesNum; i++) {
@@ -155,9 +155,9 @@ public class SlideshowModel extends Model
// Create media models for each slide.
NodeList mediaNodes = par.getChildNodes();
int mediaNum = mediaNodes.getLength();
ArrayList<MediaModel> mediaSet = new ArrayList<MediaModel>(mediaNum);
ArrayList<MediaModel> mediaSet = new ArrayList<>(mediaNum);
ArrayList<String> srcs = new ArrayList<String>(mediaNum);
ArrayList<String> srcs = new ArrayList<>(mediaNum);
for (int j = 0; j < mediaNum; j++) {
SMILMediaElement sme = (SMILMediaElement) mediaNodes.item(j);
srcs.add(sme.getSrc());
@@ -282,7 +282,7 @@ public class SmilHelper {
// Create REGIONs and append them to LAYOUT
ArrayList<RegionModel> regions = layouts.getRegions();
ArrayList<SMILRegionElement> smilRegions = new ArrayList<SMILRegionElement>();
ArrayList<SMILRegionElement> smilRegions = new ArrayList<>();
for (RegionModel r : regions) {
SMILRegionElement smilRegion = (SMILRegionElement) document.createElement("region");
smilRegion.setId(r.getRegionId());
@@ -93,7 +93,7 @@ public class MmsReceiver extends BroadcastReceiver {
private HashSet<String> getRecipients(GenericPdu pdu) {
PduHeaders header = pdu.getPduHeaders();
HashMap<Integer, EncodedStringValue[]> addressMap = new HashMap<Integer, EncodedStringValue[]>(ADDRESS_FIELDS.length);
HashMap<Integer, EncodedStringValue[]> addressMap = new HashMap<>(ADDRESS_FIELDS.length);
for (int addrType : ADDRESS_FIELDS) {
EncodedStringValue[] array = null;
if (addrType == PduHeaders.FROM) {
@@ -107,7 +107,7 @@ public class MmsReceiver extends BroadcastReceiver {
}
addressMap.put(addrType, array);
}
HashSet<String> recipients = new HashSet<String>();
HashSet<String> recipients = new HashSet<>();
loadRecipients(PduHeaders.FROM, recipients, addressMap, false);
loadRecipients(PduHeaders.TO, recipients, addressMap, true);
return recipients;
@@ -461,7 +461,7 @@ public class SmsHelper {
public static List<String> getUnseenMessageNames(Context context) {
List<Message> messages = getUnseenMessages(context);
List<String> names = new ArrayList<String>();
List<String> names = new ArrayList<>();
for (int i = 0; i < messages.size(); i++) {
if (!names.contains(messages.get(i).getName()))
@@ -485,7 +485,7 @@ public class SmsHelper {
public static List<Message> getUnseenMessages(Context context) {
List<Message> messages = new ArrayList<Message>();
List<Message> messages = new ArrayList<>();
try {
cursor = context.getContentResolver().query(RECEIVED_MESSAGE_CONTENT_PROVIDER, new String[]{COLUMN_ID}, UNSEEN_SELECTION + " AND " + UNREAD_SELECTION, null, sortDateDesc);
@@ -524,7 +524,7 @@ public class SmsHelper {
public static List<Message> getFailedMessages(Context context) {
List<Message> messages = new ArrayList<Message>();
List<Message> messages = new ArrayList<>();
try {
cursor = context.getContentResolver().query(SMS_CONTENT_PROVIDER, new String[]{COLUMN_ID}, FAILED_SELECTION, null, sortDateDesc);
@@ -546,7 +546,7 @@ public class SmsHelper {
Log.d(TAG, "Deleting failed messages");
List<Message> messages = new ArrayList<Message>();
List<Message> messages = new ArrayList<>();
try {
cursor = context.getContentResolver().query(SMS_CONTENT_PROVIDER, new String[]{COLUMN_ID}, FAILED_SELECTION, null, sortDateDesc);
@@ -123,7 +123,7 @@ public class DeliveryReportHelper {
return null;
}
List<DeliveryReportItem> items = new ArrayList<DeliveryReportItem>();
List<DeliveryReportItem> items = new ArrayList<>();
while (c.moveToNext()) {
// For sent messages with delivery reports, we stick the delivery time in the
// date_sent column (see MessageStatusReceiver).
@@ -236,8 +236,7 @@ public class DeliveryReportHelper {
}
try {
Map<String, MmsReportStatus> statusMap =
new HashMap<String, MmsReportStatus>();
Map<String, MmsReportStatus> statusMap = new HashMap<>();
while (c.moveToNext()) {
String recipient = c.getString(COLUMN_RECIPIENT);
@@ -270,7 +269,7 @@ public class DeliveryReportHelper {
return null;
}
List<MmsReportRequest> reqList = new ArrayList<MmsReportRequest>();
List<MmsReportRequest> reqList = new ArrayList<>();
while (c.moveToNext()) {
reqList.add(new MmsReportRequest(
c.getString(COLUMN_RECIPIENT),
@@ -502,7 +502,7 @@ public class SlideView extends AbsoluteLayout implements
}
// Layout views to fit the LinearLayout from left to right, then top to
// bottom.
TreeMap<Position, View> viewsByPosition = new TreeMap<Position, View>(new Comparator<Position>() {
TreeMap<Position, View> viewsByPosition = new TreeMap<>(new Comparator<Position>() {
public int compare(Position p1, Position p2) {
int l1 = p1.mLeft;
int t1 = p1.mTop;
@@ -32,7 +32,7 @@ public class SearchFragment extends QKContentFragment implements RecyclerCursorA
// Track which TextView's show which Contact objects so that we can update
// appropriately when the Contact gets fully loaded.
private HashMap<Contact, QKTextView> mContactMap = new HashMap<Contact, QKTextView>();
private HashMap<Contact, QKTextView> mContactMap = new HashMap<>();
private Context mContext;
private SharedPreferences mPrefs;
@@ -219,7 +219,7 @@ public class SettingsFragment extends PreferenceFragment implements
// If this is a preference category, make sure to go through all the subpreferences as
// well.
if (pref instanceof PreferenceCategory) {
Stack<PreferenceCategory> stack = new Stack<PreferenceCategory>();
Stack<PreferenceCategory> stack = new Stack<>();
stack.push((PreferenceCategory) pref);
do {
@@ -598,7 +598,7 @@ public class SettingsFragment extends PreferenceFragment implements
Set<String> defaultResponses = new HashSet<>(Arrays.asList(mContext.getResources().getStringArray(R.array.qk_responses)));
Set<String> responseSet = mPrefs.getStringSet(SettingsFragment.QK_RESPONSES, defaultResponses);
ArrayList<String> responses = new ArrayList<String>();
ArrayList<String> responses = new ArrayList<>();
responses.addAll(responseSet);
Collections.sort(responses);
for (int i = responses.size(); i < 12; i++) {
@@ -93,7 +93,7 @@ public class CustomViewAbove extends ViewGroup {
private SlidingMenu.OnClosedListener mClosedListener;
private SlidingMenu.OnOpenedListener mOpenedListener;
private List<View> mIgnoredViews = new ArrayList<View>();
private List<View> mIgnoredViews = new ArrayList<>();
// private int mScrollState = SCROLL_STATE_IDLE;
@@ -50,7 +50,7 @@ public class DemoConversationCursorLoader extends Loader<Cursor> {
// First, build a list of all results. Then, filter the results using mSelection and return
// that list.
ArrayList<MessageData> candidates = new ArrayList<MessageData>();
ArrayList<MessageData> candidates = new ArrayList<>();
if (THREAD_ID_WELCOME_SCREEN == mThreadId) {
candidates = new ArrayList<MessageData>();
@@ -70,7 +70,7 @@ public class DemoConversationCursorLoader extends Loader<Cursor> {
}
// Build the actual list based on the selection.
ArrayList<MessageData> data = new ArrayList<MessageData>();
ArrayList<MessageData> data = new ArrayList<>();
for (MessageData m : candidates) {
if (!SmsHelper.UNREAD_SELECTION.equals(mSelection) || m.read == 0) {
data.add(m);