本文整理汇总了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;
}