English 中文(简体)
可否赔偿
原标题:Reliability of `TreeSet` for orderability

是否可靠地使用以下《 Java法》:

TreeSet<String> ts = new TreeSet<String>();
String stringAtIndexThree = Arrays.<Tag> asList(list.toArray(new Tag[list.size()])).get(3);

将物体列入第三指数(假设ts.size() > 3)?

也就是说,如果对这套法规不作修改,那么<代码>TreeSet<T>#toArray(T[])将始终按同一顺序归还这些要素?

如果是这样的话,就应当有一个<代码>ComboBoxModel的执行,而这种执行应只具有独特的要素(最好使用不存在的)。

感谢!

WC

最佳回答

如果对这块土地没有作任何修改,树木将永远按同一顺序归还这些元素?

绝对——<代码>TreeSet 相同顺序的返回要素。 当然,在执行可比计划时,你应发挥 n的作用,以便按你的期望进行分类。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签