當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeMap.values方法代碼示例

本文整理匯總了Java中java.util.TreeMap.values方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeMap.values方法的具體用法?Java TreeMap.values怎麽用?Java TreeMap.values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.TreeMap的用法示例。


在下文中一共展示了TreeMap.values方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseLocales

import java.util.TreeMap; //導入方法依賴的package包/類
/**
 * Parse request locales.
 */
protected void parseLocales() {

    localesParsed = true;

    // Store the accumulated languages that have been requested in
    // a local collection, sorted by the quality value (so we can
    // add Locales in descending order).  The values will be ArrayLists
    // containing the corresponding Locales to be added
    TreeMap<Double, ArrayList<Locale>> locales = new TreeMap<Double, ArrayList<Locale>>();

    Enumeration<String> values = getHeaders("accept-language");

    while (values.hasMoreElements()) {
        String value = values.nextElement();
        parseLocalesHeader(value, locales);
    }

    // Process the quality values in highest->lowest order (due to
    // negating the Double value when creating the key)
    for (ArrayList<Locale> list : locales.values()) {
        for (Locale locale : list) {
            addLocale(locale);
        }
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:29,代碼來源:Request.java

示例2: saveDat

import java.util.TreeMap; //導入方法依賴的package包/類
static boolean saveDat(String path, TreeMap<String, Integer> map)
{
    try
    {
        DataOutputStream out = new DataOutputStream(new BufferedOutputStream(IOUtil.newOutputStream(path)));
        Collection<Integer> freqList = map.values();
        out.writeInt(freqList.size());
        for (int freq : freqList)
        {
            out.writeInt(freq);
        }
        trie.save(out);
        out.close();
    }
    catch (Exception e)
    {
        logger.log(Level.WARNING, "在緩存" + path + "時發生異常", e);
        return false;
    }

    return true;
}
 
開發者ID:priester,項目名稱:hanlpStudy,代碼行數:23,代碼來源:CoreBiGramMixDictionary.java

示例3: saveDat

import java.util.TreeMap; //導入方法依賴的package包/類
static boolean saveDat(String path, TreeMap<String, String> map)
{
    Collection<String> dependencyList = map.values();
    // 緩存值文件
    try
    {
        DataOutputStream out = new DataOutputStream(IOUtil.newOutputStream(path +  ".bi" + Predefine.BIN_EXT));
        out.writeInt(dependencyList.size());
        for (String dependency : dependencyList)
        {
            out.writeUTF(dependency);
        }
        if (!trie.save(out)) return false;
        out.close();
    }
    catch (Exception e)
    {
        logger.warning("保存失敗" + e);
        return false;
    }
    return true;
}
 
開發者ID:priester,項目名稱:hanlpStudy,代碼行數:23,代碼來源:BigramDependencyModel.java

示例4: dispatch

import java.util.TreeMap; //導入方法依賴的package包/類
public static void dispatch(IEvent event) {
	TreeMap<String, IEventListener> listenerMap = listenersMap
			.get(event.getType());
	if (listenerMap == null)
		return;
	for (IEventListener listener : listenerMap.values()) {
		if (listener != null) {
			try{
				listener.handle(event);
			} catch(Exception e) {
				System.out.println("\nException, while handling event: " + event + "\n");
				e.printStackTrace();
			}
		}
	}

}
 
開發者ID:x7-framework,項目名稱:x7,代碼行數:18,代碼來源:EventDispatcher.java

示例5: main

import java.util.TreeMap; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
    TreeMap<String, Double> map = new TreeMap<>();
    BufferedReader fileReader = new BufferedReader(new FileReader(args[0]));

    double max = Double.MIN_VALUE;
    while (fileReader.ready()) {
        String s = fileReader.readLine();
        String[] strs = s.split("[\\s\\t\\n\\x0B\\f\\r]");
        String key = strs[0];
        double value = Double.parseDouble(strs[1]);
        if (map.containsKey(key)) {
            map.put(key, map.get(strs[0]) + value);
        } else
            map.put(key, value);
    }
    fileReader.close();

    //Max
    for (Double a : map.values())
        if (max < a)
            max = a;

    //show
    for (Map.Entry<String, Double> pair : map.entrySet())
        if (pair.getValue().equals(max))
            System.out.println(pair.getKey());
}
 
開發者ID:avedensky,項目名稱:JavaRushTasks,代碼行數:28,代碼來源:Solution.java

示例6: getAnimations

import java.util.TreeMap; //導入方法依賴的package包/類
public Collection<AnimationPart> getAnimations(String partName)
{
	TreeMap<Integer, AnimationPart> parts = partsByPartName.get(partName);
	if (parts == null)
	{
		return Collections.emptyList();
	}
	return parts.values();
}
 
開發者ID:ObsidianSuite,項目名稱:ObsidianSuite,代碼行數:10,代碼來源:AnimationSequence.java

示例7: main

import java.util.TreeMap; //導入方法依賴的package包/類
public static void main(String[] args) {

		HashMap<Agencia, Cliente[]> hm = new HashMap<Agencia, Cliente[]>();
		// adiciona chave - agência e valor = array Cliente
		hm.put(new Agencia("ag01"), new Cliente[] { new Cliente("Enricando Cardoso"), new Cliente("Inacio Estole"), new Cliente("Luiz Ladrum"), });
		hm.put(new Agencia("ag02"), new Cliente[] { new Cliente("Henri Cando"), new Cliente("Stolin Lu La"), new Cliente("Lara Pio"), });
		hm.put(new Agencia("ag03"), new Cliente[] { new Cliente("Sony Gando"), new Cliente("Leiro Pisto"), new Cliente("Waga Oubum Du"), });

		// criando TreeMap
		TreeMap<Agencia, Cliente[]> tm = new TreeMap<Agencia, Cliente[]>(hm);

		// imprime a coleção
		System.out.println(tm);

		// pega as chaves
		Set chaves = tm.keySet();

		// imprime as chaves
		System.out.println(chaves);

		// pega os valores
		Collection<Cliente[]> valores = tm.values();

		// imprime os valores
		for (Cliente[] cs : valores) {
			for (Cliente c : cs) {
				System.out.println(c);
			}
		}
	}
 
開發者ID:alexferreiradev,項目名稱:3way_laboratorios,代碼行數:31,代碼來源:TesteTreeMap.java

示例8: getLocationStr

import java.util.TreeMap; //導入方法依賴的package包/類
private String getLocationStr(ActionNode node, GraphInfo gi) {
	if (gi != null) {
		SelectionalPreference pref = gi.getSelectionalPreferencesOfNode(node);
		if (pref.loc != null) {
			return pref.loc.string();
		}
		return null;
	}
	Iterator<Argument> prep_it = node.event().prepositionalArgIterator();
	while (prep_it.hasNext()) {
		Argument prep = prep_it.next();
		if (prep.type() == Type.LOCATION) {
			return prep.string();
		}
	}
	TreeMap<Integer, Set<Triple<ActionNode, Argument, String>>> dests = node.getDestinationsForEntity("");
	if (dests != null) {
		for (Set<Triple<ActionNode, Argument, String>> dest_set : dests.values()) {
			for (Triple<ActionNode, Argument, String> dest : dest_set) {
				if (dest.getSecond().type() == Type.LOCATION) {
					return node.event().dobj().string();
				}
			}
		}
	}
	return null;
}
 
開發者ID:uwnlp,項目名稱:recipe-interpretation,代碼行數:28,代碼來源:GoldStandardEvaluator.java

示例9: saveDat

import java.util.TreeMap; //導入方法依賴的package包/類
boolean saveDat(String path, TreeMap<String, Attribute> map)
{
    Collection<Attribute> attributeList = map.values();
    // 緩存值文件
    try
    {
        DataOutputStream out = new DataOutputStream(IOUtil.newOutputStream(path + Predefine.BIN_EXT));
        out.writeInt(attributeList.size());
        for (Attribute attribute : attributeList)
        {
            out.writeInt(attribute.p.length);
            for (int i = 0; i < attribute.p.length; ++i)
            {
                char[] charArray = attribute.dependencyRelation[i].toCharArray();
                out.writeInt(charArray.length);
                for (char c : charArray)
                {
                    out.writeChar(c);
                }
                out.writeFloat(attribute.p[i]);
            }
        }
        if (!trie.save(out)) return false;
        out.close();
    }
    catch (Exception e)
    {
        logger.warning("保存失敗" + e);
        return false;
    }
    return true;
}
 
開發者ID:priester,項目名稱:hanlpStudy,代碼行數:33,代碼來源:WordNatureDependencyModel.java

示例10: orderByColocation

import java.util.TreeMap; //導入方法依賴的package包/類
private LinkedHashMap<String, PartitionedRegion> orderByColocation(
    TreeMap<String, PartitionedRegion> prMap) {
  LinkedHashMap<String, PartitionedRegion> orderedPrMap = new LinkedHashMap();
  for (PartitionedRegion pr : prMap.values()) {
    addColocatedChildRecursively(orderedPrMap, pr);
  }
  return orderedPrMap;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:9,代碼來源:GemFireCacheImpl.java

示例11: dispatch

import java.util.TreeMap; //導入方法依賴的package包/類
public static void dispatch(MessageEvent event)  {
	TreeMap<String, IEventListener> listenerMap = listenersMap
			.get(event.getType());
	if (listenerMap == null)
		return;
	
	System.out.println(event.getType() + ", listenerMap.size = " + listenerMap.size());
	
	for (IEventListener listener : listenerMap.values()) {
		if (listener != null) {
			try{
				if (event.getReTimes() == 0){
					listener.handle(event);
				}else if ( !Objects.isNull(event.getTag()) && event.getTag().equals(listener.getClass().getName())){
					listener.handle(event);
				}
				
			}catch (Exception e){
				
				MessageListenerException mle = new MessageListenerException("Exception, listener: " + listener  + ", event: " + event);
				mle.setTag(listener.getClass().getName());
				
				throw mle;
			}
		}
	}

}
 
開發者ID:x7-framework,項目名稱:x7,代碼行數:29,代碼來源:EventDispatcherX.java

示例12: FriendsListRecycler

import java.util.TreeMap; //導入方法依賴的package包/類
public FriendsListRecycler(FragmentActivity context) {
    this.mContext = context;

    // remove self and display all others
    TreeMap<String, User> tempHashMap = new TreeMap<>(UserHelper.getInstance().getAllContacts());
    tempHashMap.remove(UserHelper.getInstance().getOwnerProfile().username);
    mUserList = new ArrayList<>(tempHashMap.values());
}
 
開發者ID:Q115,項目名稱:Goalie_Android,代碼行數:9,代碼來源:FriendsListRecycler.java

示例13: notifyDataSetHasChanged

import java.util.TreeMap; //導入方法依賴的package包/類
public void notifyDataSetHasChanged() {
    TreeMap<String, User> tempHashMap = new TreeMap<>(UserHelper.getInstance().getAllContacts());
    tempHashMap.remove(UserHelper.getInstance().getOwnerProfile().username);
    mUserList = new ArrayList<>(tempHashMap.values());

    super.notifyDataSetChanged();
}
 
開發者ID:Q115,項目名稱:Goalie_Android,代碼行數:8,代碼來源:FriendsListRecycler.java

示例14: testValues

import java.util.TreeMap; //導入方法依賴的package包/類
/**
 * values collection contains all values
 */
public void testValues() {
    TreeMap map = map5();
    Collection s = map.values();
    assertEquals(5, s.size());
    assertTrue(s.contains("A"));
    assertTrue(s.contains("B"));
    assertTrue(s.contains("C"));
    assertTrue(s.contains("D"));
    assertTrue(s.contains("E"));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:TreeMapTest.java

示例15: extractUsingResultSet

import java.util.TreeMap; //導入方法依賴的package包/類
/**
 * Converts an Array into a List using {@link Array#getResultSet()}. This implementation is
 * recursive and can parse multi-dimensional arrays.
 */
static List<?> extractUsingResultSet(Array array, Calendar calendar) throws SQLException {
  ResultSet arrayValues = array.getResultSet();
  TreeMap<Integer, Object> map = new TreeMap<>();
  while (arrayValues.next()) {
    // column 1 is the index in the array, column 2 is the value.
    // Recurse on `getValue` to unwrap nested types correctly.
    // `j` is zero-indexed and incremented for us, thus we have `1` being used twice.
    map.put(arrayValues.getInt(1), getValue(arrayValues, array.getBaseType(), 1, calendar));
  }
  // If the result set is not in the same order as the actual Array, TreeMap fixes that.
  // Need to make a concrete list to ensure Jackson serialization.
  return new ArrayList<>(map.values());
}
 
開發者ID:apache,項目名稱:calcite-avatica,代碼行數:18,代碼來源:JdbcResultSet.java


注:本文中的java.util.TreeMap.values方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。