java.util.HashMap#Entry ( )源码实例Demo

下面列出了java.util.HashMap#Entry ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: phoenix   文件: CreateTableIT.java
@Test
public void testCreateTableWithConnLevelUpdateCacheFreq() throws Exception {
    String tableName = generateUniqueName();
    Properties props = PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES);

    HashMap<String, Long> expectedUCF = new HashMap<>();
    expectedUCF.put("10", new Long(10L));
    expectedUCF.put("0", new Long(0L));
    expectedUCF.put("10000", new Long(10000L));
    expectedUCF.put("ALWAYS", new Long(0L));
    expectedUCF.put("NEVER", new Long(Long.MAX_VALUE));

    for (HashMap.Entry<String, Long> entry : expectedUCF.entrySet()) {
        String connLevelUCF = entry.getKey();
        long expectedUCFInSysCat = entry.getValue();

        String createTableString = "CREATE TABLE " + tableName + " (k VARCHAR PRIMARY KEY,"
                + "v1 VARCHAR, v2 VARCHAR)";
        props.put(QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB, connLevelUCF);
        verifyUCFValueInSysCat(tableName, createTableString, props, expectedUCFInSysCat);
    }
}
 
源代码2 项目: old-mzmine3   文件: ToggleParameterSetEditor.java
@Override
public ValueType getValue() {
  ObservableList<ToggleButton> buttons = segmentedButton.getButtons();
  for (ToggleButton button : buttons) {
    if (button.isSelected()) {
      String buttonText = button.getText();

      for (HashMap.Entry<String, ParameterSet> entry : toggleValues.entrySet()) {
        segmentedButton.getButtons().add(new ToggleButton(entry.getKey()));
        if (entry.getKey().equals(buttonText)) {
          return (ValueType) entry.getKey();
        }
      }

    }
  }
  return null;
}
 
源代码3 项目: xresloader   文件: DataDstWriterNode.java
public ArrayList<DataDstFieldDescriptor> getSortedFields() {
    if (this.fields_by_name == null) {
        return null;
    }

    if (this.sortedFields != null && this.sortedFields.size() == this.fields_by_name.size()) {
        return this.sortedFields;
    }

    this.sortedFields = new ArrayList<DataDstFieldDescriptor>();
    this.sortedFields.ensureCapacity(this.fields_by_name.size());
    for (HashMap.Entry<String, DataDstFieldDescriptor> d : this.fields_by_name.entrySet()) {
        this.sortedFields.add(d.getValue());
    }
    this.sortedFields.sort((l, r) -> {
        return Integer.compare(l.getIndex(), r.getIndex());
    });
    return this.sortedFields;
}
 
源代码4 项目: TelePlus-Android   文件: ChatAttachAlert.java
private void updatePhotosCounter() {
    if (counterTextView == null) {
        return;
    }
    boolean hasVideo = false;
    for (HashMap.Entry<Object, Object> entry : selectedPhotos.entrySet()) {
        MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) entry.getValue();
        if (photoEntry.isVideo) {
            hasVideo = true;
            break;
        }
    }
    if (hasVideo) {
        counterTextView.setText(LocaleController.formatPluralString("Media", selectedPhotos.size()).toUpperCase());
    } else {
        counterTextView.setText(LocaleController.formatPluralString("Photos", selectedPhotos.size()).toUpperCase());
    }
}
 
源代码5 项目: TelePlus-Android   文件: ChatAttachAlert.java
private void updatePhotosCounter() {
    if (counterTextView == null) {
        return;
    }
    boolean hasVideo = false;
    for (HashMap.Entry<Object, Object> entry : selectedPhotos.entrySet()) {
        MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) entry.getValue();
        if (photoEntry.isVideo) {
            hasVideo = true;
            break;
        }
    }
    if (hasVideo) {
        counterTextView.setText(LocaleController.formatPluralString("Media", selectedPhotos.size()).toUpperCase());
    } else {
        counterTextView.setText(LocaleController.formatPluralString("Photos", selectedPhotos.size()).toUpperCase());
    }
}
 
源代码6 项目: AndroidChromium   文件: WebappRegistry.java
/**
 * 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();
    }
}
 
源代码7 项目: xresloader   文件: DataDstWriterNode.java
public ArrayList<DataDstFieldDescriptor> getSortedFields() {
    if (fields == null) {
        return null;
    }

    if (sortedFields != null && sortedFields.size() == fields.size()) {
        return sortedFields;
    }

    sortedFields = new ArrayList<DataDstFieldDescriptor>();
    sortedFields.ensureCapacity(fields.size());
    for (HashMap.Entry<String, DataDstFieldDescriptor> d : fields.entrySet()) {
        sortedFields.add(d.getValue());
    }
    sortedFields.sort((l, r) -> {
        return Integer.compare(l.getIndex(), r.getIndex());
    });
    return sortedFields;
}
 
源代码8 项目: Telegram   文件: FileRefController.java
private void cleanupCache() {
    if (Math.abs(SystemClock.elapsedRealtime() - lastCleanupTime) < 60 * 10 * 1000) {
        return;
    }
    lastCleanupTime = SystemClock.elapsedRealtime();

    ArrayList<String> keysToDelete = null;
    for (HashMap.Entry<String, CachedResult> entry : responseCache.entrySet()) {
        CachedResult cachedResult = entry.getValue();
        if (Math.abs(SystemClock.elapsedRealtime() - cachedResult.firstQueryTime) >= 60 * 10 * 1000) {
            if (keysToDelete == null) {
                keysToDelete = new ArrayList<>();
            }
            keysToDelete.add(entry.getKey());
        }
    }
    if (keysToDelete != null) {
        for (int a = 0, size = keysToDelete.size(); a < size; a++) {
            responseCache.remove(keysToDelete.get(a));
        }
    }
}
 
源代码9 项目: old-mzmine3   文件: ToggleParameterSetParameter.java
@Override
public void loadValueFromXML(@Nonnull Element xmlElement) {
  String stringValue = xmlElement.getTextContent();
  for (HashMap.Entry<String, ParameterSet> entry : toggleValues.entrySet()) {
    if (entry.getKey().toString().equals(stringValue)) {
      setValue(entry.getKey());
      break;
    }
  }
}
 
源代码10 项目: JavaExercises   文件: Solution.java
public static void removeTheFirstNameDuplicates(HashMap<String, String> map) {
    ArrayList<String> list = new ArrayList();
    for (HashMap.Entry<String, String> item : map.entrySet()) {
        list.add(item.getValue());
    }
    for (String name : list)
        if (Collections.frequency(list, name) > 1)
            removeItemFromMapByValue(map, name);
    //System.out.println(map); // чтобы увидеть результаты
}
 
源代码11 项目: TelePlus-Android   文件: Emoji.java
public static void saveRecentEmoji() {
    SharedPreferences preferences = MessagesController.getGlobalEmojiSettings();
    StringBuilder stringBuilder = new StringBuilder();
    for (HashMap.Entry<String, Integer> entry : emojiUseHistory.entrySet()) {
        if (stringBuilder.length() != 0) {
            stringBuilder.append(",");
        }
        stringBuilder.append(entry.getKey());
        stringBuilder.append("=");
        stringBuilder.append(entry.getValue());
    }
    preferences.edit().putString("emojis2", stringBuilder.toString()).commit();
}
 
源代码12 项目: Alink   文件: TreeModelDataConverter.java
@Override
public void reduce(Iterable <Row> input, Collector <Row> output) throws Exception {
	HashMap <Integer, Integer> finalMap = new HashMap <>(1000);

	for (Row value : input) {
		if ((Long)value.getField(0) == 0L || value.getField(2) != null) {
			continue;
		}
		String nodeDetail = (String) value.getField(1);
		TreeModelDataConverter.NodeSerializable lc = JsonConverter.fromJson(
			nodeDetail, TreeModelDataConverter.NodeSerializable.class);
		if (lc != null && lc.node != null) {
			int featureId = lc.node.getFeatureIndex();
			if (featureId < 0) {
				continue;
			}
			if (!finalMap.containsKey(featureId)) {
				finalMap.put(featureId, 1);
			} else {
				finalMap.put(featureId, finalMap.get(featureId) + 1);
			}
			//System.out.println("lc " + );
		}
	}
	for (HashMap.Entry <Integer, Integer> index : finalMap.entrySet()) {
		//System.out.println("key "+index.getKey()+" value "+index.getValue());
		Row row = new Row(2);
		row.setField(0, featureColNames[index.getKey()]);
		row.setField(1, (long) index.getValue());
		output.collect(row);
		//System.out.println("row "+row);
	}
}
 
public void updatePositions() {
    if (mapView == null) {
        return;
    }
    Projection projection = mapView.getProjection();
    for (HashMap.Entry<Marker, View> entry : views.entrySet()) {
        Marker marker = entry.getKey();
        View view = entry.getValue();
        Point point = projection.toPixels(marker.getPosition(),null);
        view.setTranslationX(point.x - view.getMeasuredWidth() / 2);
        view.setTranslationY(point.y - view.getMeasuredHeight() + AndroidUtilities.dp(22));
    }
}
 
源代码14 项目: TelePlus-Android   文件: LruCache.java
/**
 * @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);
        }
    }
}
 
源代码15 项目: 365browser   文件: WebappRegistry.java
/**
 * Returns the WebappDataStorage object whose scope most closely matches the provided URL, or
 * null if a matching web app cannot be found. The most closely matching scope is the longest
 * scope which has the same prefix as the URL to open.
 * @param url The URL to search for.
 * @return The storage object for the web app, or null if one cannot be found.
 */
public WebappDataStorage getWebappDataStorageForUrl(final String url) {
    WebappDataStorage bestMatch = null;
    int largestOverlap = 0;
    for (HashMap.Entry<String, WebappDataStorage> entry : mStorages.entrySet()) {
        WebappDataStorage storage = entry.getValue();
        String scope = storage.getScope();
        if (url.startsWith(scope) && scope.length() > largestOverlap) {
            bestMatch = storage;
            largestOverlap = scope.length();
        }
    }
    return bestMatch;
}
 
@Override
public Object beforeInvoke(Object target, Method method, Object[] args) {
    LogUtil.d("authorities", args[0]);
    ArrayList<PluginDescriptor> plugins = PluginManager.getPlugins();
    PluginProviderInfo info = null;
    PluginDescriptor pluginDescriptor = null;
    if (plugins != null) {
        for(PluginDescriptor descriptor:plugins) {
            HashMap<String, PluginProviderInfo> pluginProviderInfoMap = descriptor.getProviderInfos();
            Iterator<HashMap.Entry<String, PluginProviderInfo>> iterator = pluginProviderInfoMap.entrySet().iterator();
            while (iterator.hasNext()) {
                HashMap.Entry<String, PluginProviderInfo> entry = iterator.next();
                if (args[0].equals(entry.getValue().getAuthority())) {
                    //如果插件中有重复的配置,先到先得
                    LogUtil.d("如果插件中有重复的配置,先到先得 authorities ", args[0]);
                    info = entry.getValue();
                    pluginDescriptor = descriptor;
                    break;
                }
            }
            if (info != null) {
                break;
            }
        }
    }
    if (info != null) {
        ProviderInfo providerInfo = new ProviderInfo();
        providerInfo.name = info.getName();
        providerInfo.packageName = getPackageName(pluginDescriptor);
        providerInfo.icon = pluginDescriptor.getApplicationIcon();
        providerInfo.metaData = pluginDescriptor.getMetaData();
        providerInfo.enabled = true;
        providerInfo.exported = info.isExported();
        providerInfo.applicationInfo = getApplicationInfo(pluginDescriptor);
        providerInfo.authority = info.getAuthority();
        return providerInfo;
    }
    return null;
}
 
源代码17 项目: Telegram-FOSS   文件: RLottieImageView.java
public void setAnimation(RLottieDrawable lottieDrawable) {
    drawable = lottieDrawable;
    if (autoRepeat) {
        drawable.setAutoRepeat(1);
    }
    if (layerColors != null) {
        drawable.beginApplyLayerColors();
        for (HashMap.Entry<String, Integer> entry : layerColors.entrySet()) {
            drawable.setLayerColor(entry.getKey(), entry.getValue());
        }
        drawable.commitApplyLayerColors();
    }
    drawable.setAllowDecodeSingleFrame(true);
    setImageDrawable(drawable);
}
 
源代码18 项目: Telegram   文件: MediaActivity.java
public MediaActivity(Bundle args, int[] media, SharedMediaLayout.SharedMediaData[] mediaData, int initTab) {
    super(args);
    hasMedia = media;
    initialTab = initTab;
    dialog_id = args.getLong("dialog_id", 0);
    for (int a = 0; a < sharedMediaData.length; a++) {
        sharedMediaData[a] = new SharedMediaLayout.SharedMediaData();
        sharedMediaData[a].max_id[0] = ((int) dialog_id) == 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE;
        if (mergeDialogId != 0 && info != null) {
            sharedMediaData[a].max_id[1] = info.migrated_from_max_id;
            sharedMediaData[a].endReached[1] = false;
        }
        if (mediaData != null) {
            sharedMediaData[a].totalCount = mediaData[a].totalCount;
            sharedMediaData[a].messages.addAll(mediaData[a].messages);
            sharedMediaData[a].sections.addAll(mediaData[a].sections);
            for (HashMap.Entry<String, ArrayList<MessageObject>> entry : mediaData[a].sectionArrays.entrySet()) {
                sharedMediaData[a].sectionArrays.put(entry.getKey(), new ArrayList<>(entry.getValue()));
            }
            for (int i = 0; i < 2; i++) {
                sharedMediaData[a].endReached[i] = mediaData[a].endReached[i];
                sharedMediaData[a].messagesDict[i] = mediaData[a].messagesDict[i].clone();
                sharedMediaData[a].max_id[i] = mediaData[a].max_id[i];
            }
        }
    }
}
 
源代码19 项目: manifold   文件: Sample.java
private HashMap.Entry<String, String> innerClassParam( HashMap.Entry<String, String> param )
{
  return param;
}
 
源代码20 项目: L2jBrasil   文件: L2FastMap.java
public Map.Entry<K, V> getNext(HashMap.Entry<K, V> priv);