关于2你理解错了,reverse的确是倒序,可是shuffle是随机排序!当然会有不同的结果!我想你还是好好的看看Java的API吧!
解决方案 »
- 关于java编写的视频播放器问题
- 阿拉伯数字的金额转换成中国传统的形式 帮忙把程序2修改一下达到和程序1一样的效果
- 请帮我看看这个10行程序里的语法错误 关于数据库操作的,显示错误17行,可我看不出来
- 怎样在JFrame中调用一个图片???
- 将运行结果输出到控制台的问题,在线等...
- synchronized同步问题
- 请问如何消除一个字符串中的换行符?
- 请问谁有基于tcp/ip协议的服务器,客户端程序的源代码?请大家帮忙!
- 想问下为什么用最新mac系统装eclipse时报错
- 关于java多线程的问题,有人指点下吗~
- 怎么得到一组radio选定的是哪个??
- 在borland主页上下的教程,按照步骤做出错!
public static int binarySearch(List list,
Object key)Searches the specified list for the specified object using the binary search algorithm. The list must be sorted into ascending order according to the natural ordering of its elements (as by the sort(List) method, above) prior to making this call. If it is not sorted, the results are undefined. If the list contains multiple elements equal to the specified object, there is no guarantee which one will be found.
This method runs in log(n) time for a "random access" list (which provides near-constant-time positional access). It may run in n log(n) time if it is called on a "sequential access" list (which provides linear-time positional access).If the specified list implements the AbstracSequentialList interface, this method will do a sequential search instead of a binary search; this offers linear performance instead of n log(n) performance if this method is called on a LinkedList object.
Parameters:
list - the list to be searched.
key - the key to be searched for.
Returns:
index of the search key, if it is contained in the list; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the list: the index of the first element greater than the key, or list.size(), if all elements in the list are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
Throws:
ClassCastException - if the list contains elements that are not mutually comparable (for example, strings and integers), or the search key in not mutually comparable with the elements of the list.