Redian新闻
>
出个简单题,看你Java APi熟悉到什么程度
avatar
出个简单题,看你Java APi熟悉到什么程度# Java - 爪哇娇娃
a*0
1
刚收到律师email,两个半月就批了。
自己citation 99,审稿也就15篇。有一篇nature,律师帮我大吹特吹。
这就批下来了,嘿嘿。
真诚推荐c m m律师
avatar
a*y
2
哪个对老年人更不利?
avatar
g*9
3
There is a Map and the integers may have duplicate values.
Now I want you to output a list of strings. The strings are sorted by their
corresponding integer values. The more compact the solution, the better.
avatar
b*o
4
祝贺

【在 a**0 的大作中提到】
: 刚收到律师email,两个半月就批了。
: 自己citation 99,审稿也就15篇。有一篇nature,律师帮我大吹特吹。
: 这就批下来了,嘿嘿。
: 真诚推荐c m m律师

avatar
i*a
5
database developer

【在 a***y 的大作中提到】
: 哪个对老年人更不利?
avatar
b*b
6

their
map.entrySet().stream().sort(e -> e.getValue()).map(e -> e.getKey()).collect
(Collectors.toList());

【在 g*********9 的大作中提到】
: There is a Map and the integers may have duplicate values.
: Now I want you to output a list of strings. The strings are sorted by their
: corresponding integer values. The more compact the solution, the better.

avatar
c*a
7
祝贺祝贺!请问lz是eb1a吗?求详细背景。。。
avatar
a*y
8
注意标题和内容的問題不一致.嘿嘿.

【在 i****a 的大作中提到】
: database developer
avatar
g*9
9
不错,可惜我对1.8不感冒。

collect

【在 b******b 的大作中提到】
:
: their
: map.entrySet().stream().sort(e -> e.getValue()).map(e -> e.getKey()).collect
: (Collectors.toList());

avatar
y*1
10
有一片nature还叫弱case,不带这么bso的阿
avatar
z*e
11
不顾虑多用的内存的话
可以把这个Map扔到另一个TreeMap>里面
SortedMap> treeMap = new TreeMap<>();
for(String s: map.keySet())
if(treeMap.get(map.get(s)) == null){
List list = new LinkedList<>();
list.add(s);
treeMap.put(map.get(s), list);
}else{
treeMap.get(map.get(s)).add(s);
}
for(Integer i: treeMap.keySet())
for(String s: treeMap.get(i))
println(s);

their

【在 g*********9 的大作中提到】
: There is a Map and the integers may have duplicate values.
: Now I want you to output a list of strings. The strings are sorted by their
: corresponding integer values. The more compact the solution, the better.

avatar
b*s
12
就是啊,nature 多难得发出来啊,都可以找faculty了。

【在 y********1 的大作中提到】
: 有一片nature还叫弱case,不带这么bso的阿
avatar
z*e
13
研究一下

collect

【在 b******b 的大作中提到】
:
: their
: map.entrySet().stream().sort(e -> e.getValue()).map(e -> e.getKey()).collect
: (Collectors.toList());

avatar
W*o
14
也要看几作不是

【在 b********s 的大作中提到】
: 就是啊,nature 多难得发出来啊,都可以找faculty了。
avatar
a*i
15
对8不感冒的不是好java

【在 g*********9 的大作中提到】
: 不错,可惜我对1.8不感冒。
:
: collect

avatar
g*9
16
还有一个更简单的也是基于TreeMap+Comparator.
尽量用Map.EntrySet。

【在 z*********e 的大作中提到】
: 不顾虑多用的内存的话
: 可以把这个Map扔到另一个TreeMap>里面
: SortedMap> treeMap = new TreeMap<>();
: for(String s: map.keySet())
: if(treeMap.get(map.get(s)) == null){
: List list = new LinkedList<>();
: list.add(s);
: treeMap.put(map.get(s), list);
: }else{
: treeMap.get(map.get(s)).add(s);

avatar
p*n
17
就做一个map.entry的comparator然后用Collections.sort搞定

【在 g*********9 的大作中提到】
: 还有一个更简单的也是基于TreeMap+Comparator.
: 尽量用Map.EntrySet。

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。