Java Code Examples for java.util.ArrayList.hashCode()

The following are Jave code examples for showing how to use hashCode() of the java.util.ArrayList class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Phoenix-for-VK   File: MagicKey.java   Source Code and License Vote up 5 votes
@Override
public int hashCode() {
    ArrayList<Object> objectList = new ArrayList<>();
    for (int i = 0, length = mParamList.size(); i < length; i++) {
        objectList.add(mBundle.get(mParamList.get(i)));
    }

    return objectList.hashCode();
}
 
Example 2
Project: AOSP-Kayboard-7.1.2   File: ContactsContentObserver.java   Source Code and License Vote up 5 votes
boolean haveContentsChanged() {
    if (!PermissionsUtil.checkAllPermissionsGranted(
            mContext, Manifest.permission.READ_CONTACTS)) {
        Log.i(TAG, "No permission to read contacts. Marking contacts as not changed.");
        return false;
    }

    final long startTime = SystemClock.uptimeMillis();
    final int contactCount = mManager.getContactCount();
    if (contactCount > ContactsDictionaryConstants.MAX_CONTACTS_PROVIDER_QUERY_LIMIT) {
        // If there are too many contacts then return false. In this rare case it is impossible
        // to include all of them anyways and the cost of rebuilding the dictionary is too high.
        // TODO: Sort and check only the most recent contacts?
        return false;
    }
    if (contactCount != mManager.getContactCountAtLastRebuild()) {
        if (DebugFlags.DEBUG_ENABLED) {
            Log.d(TAG, "haveContentsChanged() : Count changed from "
                    + mManager.getContactCountAtLastRebuild() + " to " + contactCount);
        }
        return true;
    }
    final ArrayList<String> names = mManager.getValidNames(Contacts.CONTENT_URI);
    if (names.hashCode() != mManager.getHashCodeAtLastRebuild()) {
        return true;
    }
    if (DebugFlags.DEBUG_ENABLED) {
        Log.d(TAG, "haveContentsChanged() : No change detected in "
                + (SystemClock.uptimeMillis() - startTime) + " ms)");
    }
    return false;
}