Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以这应该很简单,因为我知道这是可能的(我只是不太了解'Set')。
所以基本上就有了这个TreeMap,我们就叫它aTree吧。所以我需要做类似的事情:
somethingHereProbably = aTree.keySet(); somethingHereProbably.toStringArray();
你可以做
Map<String, Object> map = ... String[] strings = map.keySet().toArray(new String[map.size()]);
这适用于任何类型的地图,包括 TreeMap