34. HashMap props = new HashMap(); 35. props.put(”key45”, “some value”); 36. props.put(”key12”, “some other value”); 37. props.put(”key39”, “yet another value”); 38. Set s = props.keySet(); 39. // insert code here What, inserted at line 39, will sort the keys in the props HashMap?() A、 Arrays.sort(s);B、 s = new TreeSet(s);C、 Collections.sort(s);D、 s = new SortedSet(s);
34. HashMap props = new HashMap(); 35. props.put(”key45”, “some value”); 36. props.put(”key12”, “some other value”); 37. props.put(”key39”, “yet another value”); 38. Set s = props.keySet(); 39. // insert code here What, inserted at line 39, will sort the keys in the props HashMap?()
- A、 Arrays.sort(s);
- B、 s = new TreeSet(s);
- C、 Collections.sort(s);
- D、 s = new SortedSet(s);
相关考题:
HashMap和Hashtable正确的说法有() A.都属于Map接口的类B.Hashtable类不是同步的,HashMap类是同步的C.Hashtable类不允许null键和null值D.HashMap类允许null键和null值
AprogrammerisdevelopingaclassKey,thatwillbeusedasakeyinastandardjava.util.HashMap.WhichtwomethodsshouldbeoverriddentoassurethatKeyworkscorrectlyasakey?() A.publicinthashCode()B.publicvoidhashCode()C.publicintcompareTo(Objecto)D.publicbooleanequals(Objecto)E.publicbooleancompareTo(Keyk)
Given:AprogrammerisdevelopingaclassKey,thatwillbeusedasakeyinastandardjava.util.HashMap.WhichtwomethodsshouldbeoverriddentoassurethatKeyworkscorrectlyasakey?() A.publicinthashCode()B.publicbooleanequals(Keyk)C.publicintcompareTo(Objecto)D.publicbooleanequals(Objecto)E.publicbooleancompareTo(Keyk)
Hashtable,HashMap,ConcurrentHashMap都是Map的实现类,它们在处理null值的存储上有细微的区别,下列哪些说法是正确的: A.Hashtable的KV都不可以为nullB.HashMap的KV都可以为nullC.HashMap的K不可以为null,V可以为nullD.ConcurrentHashMap的KV都不可以为null
如果HashMap发生大量Hash冲突,则会导致()A、HashMap崩溃,导致不可用B、HashMap没有影响,依然可以高效的工作C、HashMap的性能会有一点影响,但总体依然是高效的D、HashMap依然可用,但是性能受到重创
public class Person { private name; public Person(String name) { this.name = name; } public int hashCode() { return 420; } } Which is true?() A、 The time to find the value from HashMap with a Person key depends on the size of the map.B、 Deleting a Person key from a HashMap will delete all map entries for all keys of typePerson.C、 Inserting a second Person object into a HashSet will cause the first Person object to beremoved as a duplicate.D、 The time to determine whether a Person object is contained in a HashSet is constant and does NOT depend on the size of the map.
HashMap和Hashtable正确的说法有() A、都属于Map接口的类B、Hashtable 类不是同步的,HashMap类是同步的C、Hashtable 类不允许 null 键和 null 值D、HashMap 类允许null 键和null 值
给定如下Java程序代码片段,编译运行这段代码,结果是()。 java.util.HashMap map=new java.util.HashMap(); map.put("name",null); map.put("name","Jack"); System.out.println(map.get("name"));A、nullB、JackC、nullJackD、运行时出现异常
线程安全的map在JDK 1.5及其更高版本环境有哪几种方法可以实现()。A、Map map = new HashMap()B、Map map = new TreeMap()C、Map map = new ConcurrentHashMap()D、Map map = Collections.synchronizedMap(new HashMap())
下列关于容器集合类的说法正确的是()。A、LinkedList继承自ListB、AbstractSet继承自SetC、HashSet继承自AbstractSeD、WeakMap继承自HashMap
现有: 1. import java.util.*; 2. 3. Class FindStuff { 4.public static void main (String[]args) { 5, //insert code here 6. c.put ("X", 123); 7. } 8. } 分别插入到第5行,哪三行允许代码编译?() A、 Map c= new SortedMap();B、 HashMap c= new HashMap();C、 HashMap c= new Hashtalole();D、 SortedMap c= new TreeMap();E、 ArrayList c= new ArrayList();F、 MaD c = new LinkedHashMap();
在Java中,关于HashMap类的描述,以下错误的是()。A、HashMap使用键/值得形式保存数据B、HashMap 能够保证其中元素的顺序C、HashMap允许将null用作键D、HashMap允许将null用作值
HashMap和HashTable的描述,错误的是()。A、他们都实现了Map接口B、HashMap非线程安全,在多个线程访问Hashtable时,不需要自己为它的方法实现同步,而HashMap就必须为之提供额外同步。C、HashMap允许将null作为一个entry的key或者value,而Hashtable不允许D、通过contains方法可以判断一个对象是否存在于HashMap或者Hashtable中
1. import java.util.*; 2. 3. Class FindStuff { 4. public static void main(String [] args) { 5. // insert code here 6. c.put("x", 123); 7. } 8. } 分别插入到第5行,哪三行允许代码编译?() A、Map c = new SortedMap();B、HashMap c = new HashMap();C、HashMap c = new Hashtable();D、SortedMap c = new TreeMap();
单选题34. HashMap props = new HashMap(); 35. props.put(”key45”, “some value”); 36. props.put(”key12”, “some other value”); 37. props.put(”key39”, “yet another value”); 38. Set s = props.keySet(); 39. // insert code here What, inserted at line 39, will sort the keys in the props HashMap?()A Arrays.sort(s);B s = new TreeSet(s);C Collections.sort(s);D s = new SortedSet(s);
多选题HashMap和Hashtable正确的说法有()A都属于Map接口的类BHashtable 类不是同步的,HashMap类是同步的CHashtable 类不允许 null 键和 null 值DHashMap 类允许null 键和null 值
单选题给定如下Java程序代码片段,编译运行这段代码,结果是()。 java.util.HashMap map=new java.util.HashMap(); map.put("name",null); map.put("name","Jack"); System.out.println(map.get("name"));AnullBJackCnullJackD运行时出现异常