当前位置: 首页>>代码示例>>Java>>正文


Java HashMap.Entry方法代码示例

本文整理汇总了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;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:23,代码来源:PLPAddressBus.java

示例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();
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:WebappRegistry.java

示例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;
    }
}
 
开发者ID:huangjingqiang,项目名称:SWDemo,代码行数:19,代码来源:SmallVideoViewLiveAdapter.java

示例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;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:17,代码来源:ContactsController.java

示例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);
        }

    }
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:19,代码来源:TestFlow.java

示例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();
}
 
开发者ID:huangjingqiang,项目名称:SWDemo,代码行数:17,代码来源:SmallVideoViewLiveAdapter.java

示例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;
    }
 
开发者ID:Lizhny,项目名称:BigDataFortuneTelling,代码行数:31,代码来源:PermissionHelper.java

示例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);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:29,代码来源:EmojiView.java

示例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);
        }
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:37,代码来源:LruCache.java

示例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;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:43,代码来源:PLPAddressBus.java

示例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();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:36,代码来源:WebappRegistry.java

示例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();
}
 
开发者ID:wildbit,项目名称:postmark-java,代码行数:20,代码来源:Parameters.java

示例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);
}
 
开发者ID:AgoraIO,项目名称:OpenVideoCall-Android,代码行数:14,代码来源:VideoViewAdapterUtil.java

示例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));
                    }
                }
            }
        }
    }
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:43,代码来源:PluginLoader.java

示例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);
            }
        }
    }
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:35,代码来源:PmHostSvc.java


注:本文中的java.util.HashMap.Entry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。