本文整理汇总了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);
}
}
}
示例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;
}
示例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;
}
示例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();
}
}
}
}
示例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());
}
示例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();
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
}
}
示例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());
}
示例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();
}
示例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"));
}
示例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());
}