本文整理匯總了Java中java.util.HashMap.Entry方法的典型用法代碼示例。如果您正苦於以下問題:Java HashMap.Entry方法的具體用法?Java HashMap.Entry怎麽用?Java HashMap.Entry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.HashMap
的用法示例。
在下文中一共展示了HashMap.Entry方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isInstruction
import java.util.HashMap; //導入方法依賴的package包/類
/**
* This method will check if given data present in the given address is an instruction or not
* @param addr address whose value needs to be verified whether it is an instruction or not
* @return true if it is an instruction or else false
*/
public synchronized boolean isInstruction(long addr)
{
boolean bInstr = false;
for(HashMap.Entry<String, IOMemoryModule> entry : modules.entrySet())
{
IOMemoryModule mod = entry.getValue();
if(mod.isAddressWithModule(addr))
{
if(mod.isInstruction(addr))
bInstr = true;
break;
}
}
return bInstr;
}
示例2: unregisterWebappsForUrlsImpl
import java.util.HashMap; //導入方法依賴的package包/類
/**
* Deletes the data of all web apps whose url matches |urlFilter|.
* @param urlFilter The filter object to check URLs.
*/
@VisibleForTesting
void unregisterWebappsForUrlsImpl(UrlFilter urlFilter) {
Iterator<HashMap.Entry<String, WebappDataStorage>> it = mStorages.entrySet().iterator();
while (it.hasNext()) {
HashMap.Entry<String, WebappDataStorage> entry = it.next();
WebappDataStorage storage = entry.getValue();
if (urlFilter.matchesUrl(storage.getUrl())) {
storage.delete();
it.remove();
}
}
if (mStorages.isEmpty()) {
mPreferences.edit().clear().apply();
} else {
mPreferences.edit().putStringSet(KEY_WEBAPP_SET, mStorages.keySet()).apply();
}
}
示例3: customizedInit
import java.util.HashMap; //導入方法依賴的package包/類
@Override
protected void customizedInit(HashMap<Integer, SurfaceView> uids, boolean force) {
for (HashMap.Entry<Integer, SurfaceView> entry : uids.entrySet()) {
if (entry.getKey() != exceptedUid) {
entry.getValue().setZOrderOnTop(true);
entry.getValue().setZOrderMediaOverlay(true);
mUsers.add(new VideoStatusData(entry.getKey(), entry.getValue(), VideoStatusData.DEFAULT_STATUS, VideoStatusData.DEFAULT_VOLUME));
}
}
if (force || mItemWidth == 0 || mItemHeight == 0) {
WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics outMetrics = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(outMetrics);
mItemWidth = outMetrics.widthPixels / 4;
mItemHeight = outMetrics.heightPixels / 4;
}
}
示例4: getContactsCopy
import java.util.HashMap; //導入方法依賴的package包/類
public HashMap<Integer, Contact> getContactsCopy(HashMap<Integer, Contact> original) {
HashMap<Integer, Contact> ret = new HashMap<>();
for (HashMap.Entry<Integer, Contact> entry : original.entrySet()) {
Contact copyContact = new Contact();
Contact originalContact = entry.getValue();
copyContact.phoneDeleted.addAll(originalContact.phoneDeleted);
copyContact.phones.addAll(originalContact.phones);
copyContact.phoneTypes.addAll(originalContact.phoneTypes);
copyContact.shortPhones.addAll(originalContact.shortPhones);
copyContact.first_name = originalContact.first_name;
copyContact.last_name = originalContact.last_name;
copyContact.id = originalContact.id;
ret.put(copyContact.id, copyContact);
}
return ret;
}
示例5: testStep
import java.util.HashMap; //導入方法依賴的package包/類
public void testStep(Object testStepkey, Object testStepValue) {
HashMap testSteps = (HashMap) testStepValue;
Iterator iter = testSteps.entrySet().iterator();
Log.e(TAG,"testSteps keyset==" + testSteps.keySet().toString());
while (iter.hasNext()) {
HashMap.Entry entry = (HashMap.Entry) iter.next();
Object testStepAction = entry.getKey();
Log.e(TAG,"testSteps testStepAction==" + testStepAction.toString());
Object testStepActionValue = entry.getValue();
Log.e(TAG,"testSteps testStepActionValue==" + testStepActionValue.toString());
testAction(testStepAction, testStepActionValue);
}
}
示例6: notifyUiChanged
import java.util.HashMap; //導入方法依賴的package包/類
@Override
public void notifyUiChanged(HashMap<Integer, SurfaceView> uids, int uidExcluded, HashMap<Integer, Integer> status, HashMap<Integer, Integer> volume) {
mUsers.clear();
for (HashMap.Entry<Integer, SurfaceView> entry : uids.entrySet()) {
log.debug("notifyUiChanged " + entry.getKey() + " " + uidExcluded);
if (entry.getKey() != uidExcluded) {
entry.getValue().setZOrderOnTop(true);
entry.getValue().setZOrderMediaOverlay(true);
mUsers.add(new VideoStatusData(entry.getKey(), entry.getValue(), VideoStatusData.DEFAULT_STATUS, VideoStatusData.DEFAULT_VOLUME));
}
}
notifyDataSetChanged();
}
示例7: getNoGrantedPermission
import java.util.HashMap; //導入方法依賴的package包/類
private ArrayList<String> getNoGrantedPermission(Context activity, boolean isShouldRationale) {
ArrayList<String> permissions = new ArrayList<>();
Iterator iterator = PERMISSION_MAP.entrySet().iterator();
while (iterator.hasNext()) {
HashMap.Entry<Integer, String> entry = (HashMap.Entry<Integer, String>) iterator.next();
String requestPermission = entry.getValue();
int checkSelfPermission = -1;
try {
checkSelfPermission = ContextCompat.checkSelfPermission(activity, requestPermission);
} catch (RuntimeException e) {
Log.e(TAG, "RuntimeException:" + e.getMessage());
return null;
}
if (checkSelfPermission != PackageManager.PERMISSION_GRANTED) {
if (shouldShowRequestPermissionRationale(requestPermission)) {
if (isShouldRationale) {
permissions.add(requestPermission);
}
} else {
if (!isShouldRationale) {
permissions.add(requestPermission);
}
}
}
}
return permissions;
}
示例8: sortEmoji
import java.util.HashMap; //導入方法依賴的package包/類
private void sortEmoji() {
recentEmoji.clear();
for (HashMap.Entry<String, Integer> entry : emojiUseHistory.entrySet()) {
recentEmoji.add(entry.getKey());
}
Collections.sort(recentEmoji, new Comparator<String>() {
@Override
public int compare(String lhs, String rhs) {
Integer count1 = emojiUseHistory.get(lhs);
Integer count2 = emojiUseHistory.get(rhs);
if (count1 == null) {
count1 = 0;
}
if (count2 == null) {
count2 = 0;
}
if (count1 > count2) {
return -1;
} else if (count1 < count2) {
return 1;
}
return 0;
}
});
while (recentEmoji.size() > 50) {
recentEmoji.remove(recentEmoji.size() - 1);
}
}
示例9: trimToSize
import java.util.HashMap; //導入方法依賴的package包/類
/**
* @param maxSize the maximum size of the cache before returning. May be -1
* to evict even 0-sized elements.
*/
private void trimToSize(int maxSize, String justAdded) {
synchronized (this) {
Iterator<HashMap.Entry<String, BitmapDrawable>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
if (size <= maxSize || map.isEmpty()) {
break;
}
HashMap.Entry<String, BitmapDrawable> entry = iterator.next();
String key = entry.getKey();
if (justAdded != null && justAdded.equals(key)) {
continue;
}
BitmapDrawable value = entry.getValue();
size -= safeSizeOf(key, value);
iterator.remove();
String[] args = key.split("@");
if (args.length > 1) {
ArrayList<String> arr = mapFilters.get(args[0]);
if (arr != null) {
arr.remove(args[1]);
if (arr.isEmpty()) {
mapFilters.remove(args[0]);
}
}
}
entryRemoved(true, key, value, null);
}
}
}
示例10: read
import java.util.HashMap; //導入方法依賴的package包/類
/**
* This method will read the data from the module
* @param addr address whose data needs to be read
* @return read object else error code
*/
public synchronized Long read(long addr)
{
Long value = null;
for(HashMap.Entry<String, IOMemoryModule> entry : modules.entrySet())
{
IOMemoryModule mod = entry.getValue();
if(mod.isAddressWithModule(addr))
{
if(!mod.isPhantom())
value = mod.read(addr);
else
{
//verify: why are we even calling read of the module if not interested in its value
mod.read(addr);
}
break;
}
}
if(value == null && isMapped(addr))
{
//Constants.PLP_SIM_MODULE_NO_DATA_ON_READ;
return null;
}
else if(!isMapped(addr))
{
//return Constants.PLP_SIM_UNMAPPED_MEMORY_ACCESS;
return null;
}
return value;
}
示例11: unregisterOldWebapps
import java.util.HashMap; //導入方法依賴的package包/類
/**
* Deletes the data for all "old" web apps, as well as all WebAPKs that have been uninstalled in
* the last month. "Old" web apps have not been opened by the user in the last 3 months, or have
* had their last used time set to 0 by the user clearing their history. Cleanup is run, at
* most, once a month.
* @param currentTime The current time which will be checked to decide if the task should be run
* and if a web app should be cleaned up.
*/
public void unregisterOldWebapps(long currentTime) {
if ((currentTime - mPreferences.getLong(KEY_LAST_CLEANUP, 0)) < FULL_CLEANUP_DURATION) {
return;
}
Iterator<HashMap.Entry<String, WebappDataStorage>> it = mStorages.entrySet().iterator();
while (it.hasNext()) {
HashMap.Entry<String, WebappDataStorage> entry = it.next();
WebappDataStorage storage = entry.getValue();
String webApkPackage = storage.getWebApkPackageName();
if (webApkPackage != null) {
if (isWebApkInstalled(webApkPackage)) {
continue;
}
} else if ((currentTime - storage.getLastUsedTime())
< WEBAPP_UNOPENED_CLEANUP_DURATION) {
continue;
}
storage.delete();
it.remove();
}
mPreferences.edit()
.putLong(KEY_LAST_CLEANUP, currentTime)
.putStringSet(KEY_WEBAPP_SET, mStorages.keySet())
.apply();
}
示例12: toString
import java.util.HashMap; //導入方法依賴的package包/類
/**
* It will convert group of parameter to a simple string.
*
* @return parameters transformed to proper string format API client accepts
*/
public String toString() {
StringBuilder parameterString = new StringBuilder();
int count = 0;
for (HashMap.Entry<String, String> entry : parameters.entrySet()) {
parameterString.append(count==0 ? "?" : "&");
parameterString.append(entry.getKey());
parameterString.append("=");
parameterString.append(entry.getValue());
count++;
}
return parameterString.toString();
}
示例13: composeDataItem1
import java.util.HashMap; //導入方法依賴的package包/類
public static void composeDataItem1(final ArrayList<UserStatusData> users, HashMap<Integer, SurfaceView> uids, int localUid) {
for (HashMap.Entry<Integer, SurfaceView> entry : uids.entrySet()) {
if (DEBUG) {
log.debug("composeDataItem1 " + (entry.getKey() & 0xFFFFFFFFL) + " " + (localUid & 0xFFFFFFFFL) + " " + users.size() + " " + entry.getValue());
}
SurfaceView surfaceV = entry.getValue();
surfaceV.setZOrderOnTop(false);
surfaceV.setZOrderMediaOverlay(false);
searchUidsAndAppend(users, entry, localUid, UserStatusData.DEFAULT_STATUS, UserStatusData.DEFAULT_VOLUME, null);
}
removeNotExisted(users, uids, localUid);
}
示例14: adjustPluginTaskAffinity
import java.util.HashMap; //導入方法依賴的package包/類
/**
* 調整插件中 Activity 的默認 TaskAffinity
*
* @param plugin 插件名稱
*/
private void adjustPluginTaskAffinity(String plugin, ApplicationInfo appInfo) {
if (appInfo == null) {
return;
}
Bundle bdl = appInfo.metaData;
if (bdl != null) {
boolean useDefault = bdl.getBoolean("use_default_task_affinity", true);
if (LOG) {
LogDebug.d(TaskAffinityStates.TAG, "useDefault = " + useDefault);
}
if (!useDefault) {
if (LOG) {
LogDebug.d(TaskAffinityStates.TAG, String.format("替換插件 %s 中默認的 TaskAffinity", plugin));
}
String defaultPluginTaskAffinity = appInfo.packageName;
for (HashMap.Entry<String, ActivityInfo> entry : mComponents.getActivityMap().entrySet()) {
ActivityInfo info = entry.getValue();
if (LOG) {
if (info != null) {
LogDebug.d(TaskAffinityStates.TAG, String.format("%s.taskAffinity = %s ", info.name, info.taskAffinity));
}
}
// 如果是默認 TaskAffinity
if (info != null && info.taskAffinity.equals(defaultPluginTaskAffinity)) {
info.taskAffinity = info.taskAffinity + "." + plugin;
if (LOG) {
LogDebug.d(TaskAffinityStates.TAG, String.format("修改 %s 的 TaskAffinity 為 %s", info.name, info.taskAffinity));
}
}
}
}
}
}
示例15: regReceiver
import java.util.HashMap; //導入方法依賴的package包/類
@Override
public void regReceiver(String plugin, Map rcvFilMap) throws RemoteException {
PluginInfo pi = RePluginOS.getPlugin(plugin, false);
if (pi == null || pi.getFrameworkVersion() < 4) {
return;
}
HashMap<String, List<IntentFilter>> receiverFilterMap = (HashMap<String, List<IntentFilter>>) rcvFilMap;
// 遍曆此插件中所有靜態聲明的 Receiver
for (HashMap.Entry<String, List<IntentFilter>> entry : receiverFilterMap.entrySet()) {
if (mReceiverProxy == null) {
mReceiverProxy = new PluginReceiverProxy();
mReceiverProxy.setActionPluginMap(mActionPluginComponents);
}
/* 保存 action-plugin-receiver 的關係 */
String receiver = entry.getKey();
List<IntentFilter> filters = entry.getValue();
if (filters != null) {
for (IntentFilter filter : filters) {
int actionCount = filter.countActions();
while (actionCount >= 1) {
saveAction(filter.getAction(actionCount - 1), plugin, receiver);
actionCount--;
}
// 注冊 Receiver
mContext.registerReceiver(mReceiverProxy, filter);
}
}
}
}