Array源码刨析

打印 上一主题 下一主题

主题 844|帖子 844|积分 2532

目录

总结:Java的Stack严格意义来说并不能说是Stack,因为它通过直接继承Vector类,继承了Vector所有的公有方法,它是一个拥有所有Vector容器方法的栈!
@SuppressWarnings

该批注的作用是给编译器一条指令,告诉它对被批注的代码元素内部的某些警告保持静默。
all抑制所有警告boxing抑制装箱、拆箱操作时候的警告cast抑制映射相关的警告dep-ann抑制启用注释的警告deprecation抑制过期方法警告fallthrough抑制确在switch中缺失breaks的警告finally抑制finally模块没有返回的警告hidingto suppress warnings relative to locals that hide variableincomplete-switch忽略没有完整的switch语句的警告nls忽略非nls格式的字符的警告null忽略对null的操作的警告rawtypes使用generics时忽略没有指定相应的类型的警告restrictionrestriction to suppress warnings relative to usage of discouraged or forbidden referencesserial忽略在serializable类中没有声明serialVersionUID变量的警告static-access抑制不正确的静态访问方式警告synthetic-access抑制子类没有按最优方法访问内部类的警告unchecked抑制没有进行类型检查操作的警告unqualified-field-access抑制没有权限访问的域的警告unused抑制没被使用过的代码的警告Spliterator

Spliterator是Java 8中加入的一个新接口;这个名字代表“可拆分迭代器”(splitable iterator)。和Iterator一样,Spliterator也用于遍历数据源中的元素,但它是为了并行执行而设计的。Java 8已经为集合框架中包含的所有数据结构提供了一个默认的Spliterator实现。
Fail-Fast

fail-fast 机制,即快速失败机制,是java集合(Collection)中的一种错误检测机制。当在迭代集合的过程中该集合在结构上发生改变的时候,就有可能会发生fail-fast,即抛出 ConcurrentModificationException异常。fail-fast机制并不保证在不同步的修改下一定会抛出异常,它只是尽最大努力去抛出,所以这种机制一般仅用于检测bug。
在Vector中依赖modCount实现,一旦modCount发生变化,那么就触发异常。
序列化

Java 提供了一种对象序列化的机制,该机制中,一个对象可以被表示为一个字节序列,该字节序列包括该对象的数据、有关对象的类型的信息和存储在对象中数据的类型。
将序列化对象写入文件之后,可以从文件中读取出来,并且对它进行反序列化,也就是说,对象的类型信息、对象的数据,还有对象中的数据类型可以用来在内存中新建对象。
Consumer

函数式编程接口
[code]@FunctionalInterfacepublic interface Consumer {    /**     * Performs this operation on the given argument.     *     * @param t the input argument     */    void accept(T t);    /**     * Returns a composed {@code Consumer} that performs, in sequence, this     * operation followed by the {@code after} operation. If performing either     * operation throws an exception, it is relayed to the caller of the     * composed operation.  If performing this operation throws an exception,     * the {@code after} operation will not be performed.     *     * @param after the operation to perform after this operation     * @return a composed {@code Consumer} that performs in sequence this     * operation followed by the {@code after} operation     * @throws NullPointerException if {@code after} is null     */    default Consumer andThen(Consumer
回复

使用道具 举报

0 个回复

正序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

万万哇

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表