- 浏览: 201004 次
- 性别:
- 来自: 哈尔滨
文章分类
- 全部博客 (267)
- java.lang (8)
- 问题汇总 (21)
- 异常记录 (20)
- 功能实现 (19)
- 面试总结 (25)
- 技巧总结 (8)
- 常用代码 (4)
- 编程习惯 (3)
- 编码规则 (3)
- java.util (10)
- java.io (1)
- JavaWeb (9)
- MySQL (16)
- SVN (3)
- MyBatis (11)
- Velocity (7)
- 其他知识 (10)
- 人生哲理 (1)
- 人生故事 (1)
- 自我感悟 (1)
- shiro (3)
- 基础知识 (0)
- 问题总结 (1)
- Spring 标签 (1)
- Spring (3)
- 点滴生活 (1)
- DOS (1)
- CAS (4)
- Linux (9)
- Storm (6)
- Shell (1)
- regex (1)
- Collection (4)
- poi (1)
- 经典语句 (1)
- NIO (5)
- concurrent (14)
- RPC (1)
- zookeeper (3)
- 待整理 (2)
- Hadoop (9)
- RabbitMq (2)
- flume (1)
- hive (7)
- hbase (4)
- kafka (1)
- scala (1)
- GC (0)
- java.util.concurrent.atomic (1)
- java.lang.ref (6)
- JVM (2)
- algorithm (1)
- conception (1)
- java key word (1)
- sun.misc (1)
最新评论
Arrays
一、总结
1.基于 jdk 1.8
二、asList
/** * Returns a fixed-size list backed by the specified array. (Changes to * the returned list "write through" to the array.) This method acts * as bridge between array-based and collection-based APIs, in * combination with {@link Collection#toArray}. The returned list is * serializable and implements {@link RandomAccess}. * * <p>This method also provides a convenient way to create a fixed-size * list initialized to contain several elements: * <pre> * List<String> stooges = Arrays.asList("Larry", "Moe", "Curly"); * </pre> * * @param a the array by which the list will be backed * @return a list view of the specified array */ public static <T> List<T> asList(T... a) { return new ArrayList<T>(a); }
1.参数为 T 多个泛型T
若参数为基础数据类型的数组,则将其视为一个整体,如 int [] a ,此时的size = 1
若参数为引用数据类型,则其size为数据的个数
2.ArrayList 非 java.util.ArrayList
三、Arrays.ArrayList 内部私有静态类
/** * @serial include */ // 继承 Abstract ,而 Abstract 实现 List ,所以 asList 才可以用 List 接收 // 即 ArrayList 间接实现了 List private static class ArrayList<E> extends AbstractList<E> // RandomAccess 可以随机访问,Serializable 可序列化 implements RandomAccess, java.io.Serializable { private static final long serialVersionUID = -2764017481108945198L; private final E[] a; ArrayList(E[] array) { if (array==null) throw new NullPointerException(); a = array; } // 以下是 ArrayList 实现的方法,无RemoveAll 方法,所以asList 的返回值List // 调用 removeAll时会抛出无此操作方法的异常 public int size() { return a.length; } public Object[] toArray() { return a.clone(); } public <T> T[] toArray(T[] a) { int size = size(); if (a.length < size) return Arrays.copyOf(this.a, size, (Class<? extends T[]>) a.getClass()); System.arraycopy(this.a, 0, a, 0, size); if (a.length > size) a[size] = null; return a; } public E get(int index) { return a[index]; } public E set(int index, E element) { E oldValue = a[index]; a[index] = element; return oldValue; } public int indexOf(Object o) { if (o==null) { for (int i=0; i<a.length; i++) if (a[i]==null) return i; } else { for (int i=0; i<a.length; i++) if (o.equals(a[i])) return i; } return -1; } public boolean contains(Object o) { return indexOf(o) != -1; } }
发表评论
-
Collections
2017-10-27 22:40 353Collections 一、总结 1.基于 JDK 1.8 ... -
LinkedList
2017-10-09 21:18 398LinkedList 一、总结 1.基 ... -
Objects
2017-10-08 12:20 365Objects 一、总结 二、equals Obje ... -
RandomAccess
2017-10-08 11:24 352RandomAccess 总结: 1.基于 JDK 1.8 ... -
ArrayList
2017-10-08 10:14 415ArrayList 一、总结 1.基于 JDK 1.8 源 ... -
HashSet
2017-09-24 15:04 296HashSet 一、总结(jdk 1.8.0_131) 1 ... -
HashTable
2017-09-23 20:54 345Hashtable 一、对比HashMap 1. 项目Ha ... -
HashMap
2017-03-11 17:48 405HashMap jdk-1.8.0 一、总结 允许key ... -
Vector
2017-03-11 14:57 475Vector 一、总结 1.线程安全 二、类 1.源 ...
相关推荐
Gain an in-depth understanding of PHP 7 arrays. After a quick overview of PHP 7, each chapter concentrates on single, multi-dimensional, associative, and object arrays. PHP Arrays is a first of its ...
radar antenna arrays, and smart antenna arrays for automatic cruise control applications provide increased safe travelling for vehicle passengers. Vehicle localization techniques based on the antenna ...
Antenna Arrays.pdf
PHP Arrays Single Multi-dimensional Associative and Object Arrays in PHP 7 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn...
PHP Arrays Single, Multi-dimensional, Associative and Object Arrays in PHP 7 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如...
《Digital Signal Processing with Field Programmable Gate Arrays》扫描版
/** *Arrays提供数组操作的一系列实用方法 *1输出 *2排序 *3二分查找 *4复制 *5扩容 */
Protein.Arrays,.Biochips,.and.Proteomics.-.Joanna.S.Albala
The contents itself is organized in three chapters according to the network architecture: arrays and trees for Chapter 1 (117 pages), meshes of trees for Chapter 2 (117 pages), and hypercubes and ...
ite_Antenna_Arrays_and_FSS
个人研究所得,包含对其内部jdk源码的分析。 同时会结合ArrayList中对该两个方法的调用做进一步说明。...总结一句话:在允许的情况下,尽量调用System.arraycopy方法,实在不行再调用Arrays.copyOf方法。
网络图片地址url集合arrays.xml文件
Microphone Arrays : A Tutorial
Constructing Compressed Suffix Arrays with Large Alphabets 生物信息论文
Various technical issues are addressed in the frequency-and time-domain finite element analysis of complex antennas and arrays that may consist of fine structures and composite materials. analysis is ...
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Java AC版本
天线圣经-Finite Antenna Arrays and FSS
Light scattering by particle and hole arrays for electric magnetic
利用电磁波的相干原理,通过计算机控制输往天线各阵元电流相位的变化来改变波束的方向,同样可进行扫描,称为电扫描。天线阵,根据扫描情况可分为相扫、频扫、相/相扫、相/频扫、机/相扫、机/频扫、有限扫等多种体制...
Digital Signal Processing with Field Programmable Gate Arrays 3rd