List of usage examples for java.util Iterator remove
default void remove()
From source file:com.cburch.logisim.gui.main.SelectionAttributes.java
private static LinkedHashMap<Attribute<Object>, Object> computeAttributes(Collection<Component> newSel) { LinkedHashMap<Attribute<Object>, Object> attrMap; attrMap = new LinkedHashMap<Attribute<Object>, Object>(); Iterator<Component> sit = newSel.iterator(); if (sit.hasNext()) { AttributeSet first = sit.next().getAttributeSet(); for (Attribute<?> attr : first.getAttributes()) { @SuppressWarnings("unchecked") Attribute<Object> attrObj = (Attribute<Object>) attr; attrMap.put(attrObj, first.getValue(attr)); }/*from w w w . j av a 2 s . c o m*/ while (sit.hasNext()) { AttributeSet next = sit.next().getAttributeSet(); Iterator<Attribute<Object>> ait = attrMap.keySet().iterator(); while (ait.hasNext()) { Attribute<Object> attr = ait.next(); if (next.containsAttribute(attr)) { Object v = attrMap.get(attr); if (v != null && !v.equals(next.getValue(attr))) { attrMap.put(attr, null); } } else { ait.remove(); } } } } return attrMap; }
From source file:com.android.launcher3.InstallShortcutReceiver.java
public static void removeFromInstallQueue(Context context, ArrayList<String> packageNames, UserHandleCompat user) {//from ww w . ja va 2s . co m if (packageNames.isEmpty()) { return; } String spKey = LauncherAppState.getSharedPreferencesKey(); SharedPreferences sp = context.getSharedPreferences(spKey, Context.MODE_PRIVATE); synchronized (sLock) { Set<String> strings = sp.getStringSet(APPS_PENDING_INSTALL, null); if (DBG) { Log.d(TAG, "APPS_PENDING_INSTALL: " + strings + ", removing packages: " + packageNames); } if (strings != null) { Set<String> newStrings = new HashSet<String>(strings); Iterator<String> newStringsIter = newStrings.iterator(); while (newStringsIter.hasNext()) { String encoded = newStringsIter.next(); PendingInstallShortcutInfo info = decode(encoded, context); if (info == null || (packageNames.contains(info.getTargetPackage()) && user.equals(info.user))) { newStringsIter.remove(); } } sp.edit().putStringSet(APPS_PENDING_INSTALL, newStrings).commit(); } } }
From source file:com.stv.launcher.receiver.InstallShortcutReceiver.java
public static void removeFromInstallQueue(Context context, ArrayList<String> packageNames, UserHandleCompat user) {/*from w w w. j av a 2 s . c om*/ if (packageNames.isEmpty()) { return; } String spKey = LauncherState.getSharedPreferencesKey(); SharedPreferences sp = context.getSharedPreferences(spKey, Context.MODE_PRIVATE); synchronized (sLock) { Set<String> strings = sp.getStringSet(APPS_PENDING_INSTALL, null); if (DBG) { Log.d(TAG, "APPS_PENDING_INSTALL: " + strings + ", removing packages: " + packageNames); } if (strings != null) { Set<String> newStrings = new HashSet<String>(strings); Iterator<String> newStringsIter = newStrings.iterator(); while (newStringsIter.hasNext()) { String encoded = newStringsIter.next(); PendingInstallShortcutInfo info = decode(encoded, context); if (info == null || (packageNames.contains(info.getTargetPackage()) && user.equals(info.user))) { newStringsIter.remove(); } } sp.edit().putStringSet(APPS_PENDING_INSTALL, newStrings).commit(); } } }
From source file:com.zimbra.cs.db.DbPool.java
private static void checkPoolUsage() { int numActive = sConnectionPool.getNumActive(); int maxActive = sConnectionPool.getMaxActive(); if (numActive <= maxActive * 0.75) return;/* www . jav a2s.c o m*/ String stackTraceMsg = "Turn on debug logging for zimbra.dbconn to see stack traces of connections not returned to the pool."; if (ZimbraLog.dbconn.isDebugEnabled()) { StringBuilder buf = new StringBuilder(); synchronized (sConnectionStackCounter) { Iterator<String> i = sConnectionStackCounter.iterator(); while (i.hasNext()) { String stackTrace = i.next(); int count = sConnectionStackCounter.getCount(stackTrace); if (count == 0) { i.remove(); } else { buf.append(count + " connections allocated at " + stackTrace + "\n"); } } } stackTraceMsg = buf.toString(); } String logMsg = "Connection pool is 75%% utilized (%d connections out of a maximum of %d in use). %s"; if (isUsageWarningEnabled) { ZimbraLog.dbconn.warn(logMsg, numActive, maxActive, stackTraceMsg); } else { ZimbraLog.dbconn.debug(logMsg, numActive, maxActive, stackTraceMsg); } }
From source file:com.mindquarry.desktop.workspace.ConflictHelper.java
/** * Finds all local files that are obstructed (ie. file changed into a folder * or vice-versa).//from w w w . j a va2 s . c o m */ public static List<Conflict> findLocalObstructed(List<Status> localChanges) { List<Conflict> conflicts = new ArrayList<Conflict>(); Iterator<Status> iter = localChanges.iterator(); while (iter.hasNext()) { Status status = iter.next(); // local OBSTRUCTED if (status.getTextStatus() == StatusKind.obstructed) { iter.remove(); conflicts.add(new ObstructedConflict(status)); } } return conflicts; }
From source file:com.parworks.androidlibrary.utils.HttpUtils.java
public static String appendQueryStringToUrl(String url, Map<String, String> queryString) { url += "?";/*from w ww . j ava 2s .co m*/ Iterator<Entry<String, String>> it = queryString.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, String> pairs = (Map.Entry<String, String>) it.next(); try { String valueToEncode = pairs.getValue(); if (valueToEncode == null) { valueToEncode = ""; } url += "&" + pairs.getKey() + "=" + URLEncoder.encode(valueToEncode, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new ARException(e); } it.remove(); } return url; }
From source file:com.gigaspaces.internal.utils.ClassLoaderCleaner.java
/** * This depends on the internals of the Sun JVM so it does everything by reflection. */// w w w . j a v a2 s. c om private static void clearReferencesRmiTargets(ClassLoader classLoader) { try { // Need access to the ccl field of sun.rmi.transport.Target Class<?> objectTargetClass = Class.forName("sun.rmi.transport.Target"); Field cclField = objectTargetClass.getDeclaredField("ccl"); cclField.setAccessible(true); // Clear the objTable map Class<?> objectTableClass = Class.forName("sun.rmi.transport.ObjectTable"); Field objTableField = objectTableClass.getDeclaredField("objTable"); objTableField.setAccessible(true); Object objTable = objTableField.get(null); if (objTable == null) { return; } // Iterate over the values in the table if (objTable instanceof Map<?, ?>) { Iterator<?> iter = ((Map<?, ?>) objTable).values().iterator(); while (iter.hasNext()) { Object obj = iter.next(); Object cclObject = cclField.get(obj); if (classLoader == cclObject) { iter.remove(); } } } // Clear the implTable map Field implTableField = objectTableClass.getDeclaredField("implTable"); implTableField.setAccessible(true); Object implTable = implTableField.get(null); if (implTable == null) { return; } // Iterate over the values in the table if (implTable instanceof Map<?, ?>) { Iterator<?> iter = ((Map<?, ?>) implTable).values().iterator(); while (iter.hasNext()) { Object obj = iter.next(); Object cclObject = cclField.get(obj); if (classLoader == cclObject) { iter.remove(); } } } } catch (Exception e) { logger.log(Level.WARNING, "Failed to clear context class loader referenced from sun.rmi.transport.Target ", e); } }
From source file:com.marlonjones.voidlauncher.InstallShortcutReceiver.java
public static void removeFromInstallQueue(Context context, HashSet<String> packageNames, UserHandleCompat user) {// ww w. j a v a 2 s . com if (packageNames.isEmpty()) { return; } SharedPreferences sp = Utilities.getPrefs(context); synchronized (sLock) { Set<String> strings = sp.getStringSet(APPS_PENDING_INSTALL, null); if (DBG) { Log.d(TAG, "APPS_PENDING_INSTALL: " + strings + ", removing packages: " + packageNames); } if (strings != null) { Set<String> newStrings = new HashSet<String>(strings); Iterator<String> newStringsIter = newStrings.iterator(); while (newStringsIter.hasNext()) { String encoded = newStringsIter.next(); PendingInstallShortcutInfo info = decode(encoded, context); if (info == null || (packageNames.contains(info.getTargetPackage()) && user.equals(info.user))) { newStringsIter.remove(); } } sp.edit().putStringSet(APPS_PENDING_INSTALL, newStrings).apply(); } } }
From source file:com.mindquarry.desktop.workspace.ConflictHelper.java
/** * Finds all local files that are marked as (content-) conflicted. *///from w w w. j av a2 s. c o m public static List<Conflict> findLocalConflicted(List<Status> localChanges) { List<Conflict> conflicts = new ArrayList<Conflict>(); Iterator<Status> iter = localChanges.iterator(); while (iter.hasNext()) { Status status = iter.next(); // local CONFLICTED, remote MODIFIED if (status.getTextStatus() == StatusKind.conflicted) { iter.remove(); conflicts.add(new ContentConflict(status)); } } return conflicts; }
From source file:com.aurel.track.admin.user.person.PersonConfigBL.java
/** * Prepares the replacement triggers/*from w w w . j a va 2 s. com*/ * @param personID * @return */ public static List<TPersonBean> prepareReplacementPersons(List<Integer> personIDs) { List<TPersonBean> replacementPersonList = PersonBL.loadPersons(); if (replacementPersonList != null && personIDs != null) { Iterator<TPersonBean> iterator = replacementPersonList.iterator(); while (iterator.hasNext()) { TPersonBean personBean = iterator.next(); if (personIDs.contains(personBean.getObjectID())) { iterator.remove(); } } } return replacementPersonList; }