`
SilverRing
  • 浏览: 71072 次
社区版块
存档分类
最新评论

[Java] RandomAccess

    博客分类:
  • Java
阅读更多
RandomAccess is a marker interface. It doesn't define methods; instead, it identifies a class as having a particular capability.

According to the online document:

The primary purpose of this interface is to allow generic algorithms 
to alter their behavior to provide good performance when applied to 
either random or sequential access lists.


To be more specific, for typical instances of the class, this loop:

for (int i=0, n=list.size(); i < n; i++)
     list.get(i);


runs faster than this loop:

for (Iterator i=list.iterator(); i.hasNext(); )
     i.next();


The well-known implementing classes are:

ArrayList, Stack, Vector
分享到:
评论

相关推荐

    了解Java:RandomAccess

    NULL 博文链接:https://lidongfu005.iteye.com/blog/2012223

    Java接口RandomAccess全面了解

    下面小编就为大家带来一篇Java接口RandomAccess全面了解。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    java 中RandomAccess接口源码分析

    主要介绍了java 中RandomAccess接口源码分析的相关资料,需要的朋友可以参考下

    java1.8源码-jdk1.8.0_151-:阅读Java源码,版本为jdk1.8.0_151,将会同步翻译源码中的文档注释

    java 1.8 源码 jdk1.8.0_151-源码的中文翻译和一些自己的理解 声明 作者现在大四快要毕业,在实习中,为了在未来成为一名架构师,下定决心开始读Java的...RandomAccess.java ArrayList.java LinkedList.java Vector.jav

    Advanced Topics in Java

    in Java), linked lists, stacks, queues, recursion, random numbers, files (text, binary, random access, indexed), binary trees, advanced sorting methods (heapsort, quicksort, mergesort, Shell sort), ...

    java7帮助文档

    The Sockets Direct Protocol (SDP) provides access to high performance network connections; see Understanding the Sockets Direct Protocol. Security A new native provider has been added that provides ...

    JavaIO.ppt

    1,methods for accessing file, text data, object ...Sequential and Random access 2,Reading and writing of primitive values 3,Applications and applets are provided with three streams automatically

    Java优化编程(第2版)

    15.3 通过randomaccess接口优化迭代列表 15.4 合并java中的多进程与系统优化 小结 附录a together工具的使用简介 附录b j2se 5.0的新特性与性能的提升 附录c 编排代码的精美工具jxbeauty 使用有道云笔记,轻松同步...

    Java 9 Data Structures and Algorithms

    Apply advanced general purpose data structures, priority queue-based sorting, and random access immutable linked lists Gain a better understanding of the concept of graphs, directed and undirected ...

    Undocumented_Secrets_of_MATLAB_Java_Programming.part2

    thousands of code snippets, hundreds of screenshots and ~1500 online references are provided to enable the utilization of this book as both a sequential tutorial and as a random-access reference ...

    Undocumented_Secrets_of_MATLAB_Java_Programming.part3

    thousands of code snippets, hundreds of screenshots and ~1500 online references are provided to enable the utilization of this book as both a sequential tutorial and as a random-access reference ...

    Undocumented Secrets of MATLAB-Java Programming .part3

    Code snippets, screenshots, and numerous online references are provided to enable the utilization of this book as both a sequential tutorial and as a random-access reference suited for immediate use....

    Undocumented Secrets of MATLAB-Java Programming .part2.rar

    Code snippets, screenshots, and numerous online references are provided to enable the utilization of this book as both a sequential tutorial and as a random-access reference suited for immediate use....

    javacv-platform-1.3.3-src

    JavaCV also comes with helper classes and methods on top of OpenCV and FFmpeg to facilitate their integration to the Java platform. Here is a small demo program demonstrating the most frequently ...

    Undocumented_Secrets_of_MATLAB_Java_Programming.part1

    thousands of code snippets, hundreds of screenshots and ~1500 online references are provided to enable the utilization of this book as both a sequential tutorial and as a random-access reference ...

    Java遍历集合方法分析(实现原理、算法性能、适用场合)

    概述 Java语言中,提供了一套数据集合框架,其中定义了一些诸如List、Set等抽象数据类型,每个抽象...1、顺序存储,Random Access(Direct Access): 这种方式,相邻的数据元素存放于相邻的内存地址中,整块内存地址

    List集合之ArrayList

    ArrayList集成AbstractList抽象类,实现了List、RandomAccess、Cloneable、java.io.Serializable这四个接口,其中我们可以看到,实现了Cloneable和Serializable接口就代表着ArrayList是支持克隆和序列化的,这里有个...

    Java进阶--深入理解ArrayList实现原理

    由上可知ArrayList继承AbstractList并且实现了List和RandomAccess,Cloneable,Serializable接口。①构造方法由上面三种构造方法可知,默认情况下使用ArrayList会生成一个大小为10的Object类型的数组。也可以调用...

    Addison.Wesley.The.Java.Programming.Language.4th.Edition.Aug.2005.chm

    Chapter 22Miscellaneous Utilitiescovers the rest of the utility classes such as bit sets, formatted output, text scanning, and random number generation. Chapter 23System Programmingleads you through ...

    Java开发技术大全 电子版

    13.4Random类的使用402 13.5Date类和Calendar类的使用404 13.5.1Date类的简单使用404 13.5.2使用SimpleDateFormat格式化输出时间405 13.5.3Calendar类的特色408 13.5.4利用GregorianCalendar输出日历411 13.6...

Global site tag (gtag.js) - Google Analytics