本文整理匯總了Java中java.util.ArrayList.hashCode方法的典型用法代碼示例。如果您正苦於以下問題:Java ArrayList.hashCode方法的具體用法?Java ArrayList.hashCode怎麽用?Java ArrayList.hashCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.ArrayList
的用法示例。
在下文中一共展示了ArrayList.hashCode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: hashCode
import java.util.ArrayList; //導入方法依賴的package包/類
@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();
}
示例2: haveContentsChanged
import java.util.ArrayList; //導入方法依賴的package包/類
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;
}