解析ArrayList类

37、Java数组与ArrayList类的深入解析 本文深入解析了Java中的高维数组、命令行参数、可变长度参数列表以及ArrayList类的使用方法。通过具体示例,讲解了高维数组在复杂数据存储中的应用,命令行参数与main方法的交互方式,可变长度参数列表的灵活使用,以及ArrayList类的创建、遍历和常用操作。此外,还提供了一个综合示例,展示了如何结合这些特性进行实际编程。内容适合Java初学者和希望深入理解核心编程技术的开发者。 阅读详情

ArrayList类的继承关系

image

在这上面可以看到ArrayList和AbstractList都是实现了List接口, 但是ArrayList又是继承了AbstractList, 所以我在看这一段代码的时候就很疑惑, 作者这样做的目的是什么?

http://stackoverflow.com/questions/2165204/why-does-linkedhashsete-extend-hashsete-and-implement-sete
可以看看这个答案, 目的就是当初作者说明这就是一个写法错误。

如何进行初始化的?

    /**
     * Shared empty array instance used for default sized empty instances. We
     * distinguish this from EMPTY_ELEMENTDATA to know how much to inflate when
     * first element is added.
     */
    private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {};

    /**
     * The array buffer into which the elements of the ArrayList are stored.
     * The capacity of the ArrayList is the length of this array buffer. Any
     * empty ArrayList with elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA
     * will be expanded to DEFAULT_CAPACITY when the first element is added.
     */
    transient Object[] elementData; // non-private to simplify nested class access

 /**
     * Constructs an empty list with the specified initial capacity.
     *
     * @param  initialCapacity  the initial capacity of the list
     * @throws IllegalArgumentException if the specified initial capacity
     *         is negative
     */
    public ArrayList(int initialCapacity) {
        if (initialCapacity > 0) {
            this.elementData = new Object[initialCapacity];
        } else if (initialCapacity == 0) {
            this.elementData = EMPTY_ELEMENTDATA;
        } else {
            throw new IllegalArgumentException("Illegal Capacity: "+
                                               initialCapacity);
        }
    }

    /**
     * Constructs an empty list with an initial capacity of ten.
     */
    public ArrayList() {
        this.elementData = DEFAULTCAPACITY_EMPTY_ELEMENTDATA;
    }
    
    /**
     * Constructs a list containing the elements of the specified
     * collection, in the order they are returned by the collection's
     * iterator.
     *
     * @param c the collection whose elements are to be placed into this list
     * @throws NullPointerException if the specified collection is null
     */
    public ArrayList(Collection<? extends E> c) {
        elementData = c.toArray();
        if ((size = elementData.length) != 0) {
            // c.toArray might (incorrectly) not return Object[] (see 6260652)
            if (elementData.getClass() != Object[].class)
                elementData = Arrays.copyOf(elementData, size, Object[].class);
        } else {
            // replace with empty array.
            this.elementData = EMPTY_ELEMENTDATA;
        }
    }

在上面的这一段中可以看到有三个构造方法, 我们来一个个的说一下各自的作用

1.无参构造方法:这个构造方法就是初始化一个集合对象, 默认的是一个容量为10的一个值, 但是要在第一次添加的时候才会填充进去。

2.第二个构造方法是传一个大小的值, 直接对Object数组对象进行初始化。
3.第三个构造方法是传一个Collection的集合, 这个时候泛型的好处就来了,在那个构造方法中不允许传和当前集合元素没有关系的类型。Collection<? extends E> c

如何添加、删除、遍历、替换。。

添加和插入
/**
     * Appends the specified element to the end of this list.
     *
     * @param e element to be appended to this list
     * @return <tt>true</tt> (as specified by {@link Collection#add})
     */
    public boolean add(E e) {
        ensureCapacityInternal(size + 1);  // Increments modCount!!
        elementData[size++] = e;
        return true;
    }

    /**
     * Inserts the specified element at the specified position in this
     * list. Shifts the element currently at that position (if any) and
     * any subsequent elements to the right (adds one to their indices).
     *
     * @param index index at which the specified element is to be inserted
     * @param element element to be inserted
     * @throws IndexOutOfBoundsException {@inheritDoc}
     */
    public void add(int index, E element) {
        rangeCheckForAdd(index);

        ensureCapacityInternal(size + 1);  // Increments modCount!!
        System.arraycopy(elementData, index, elementData, index + 1,
                         size - index);
        elementData[index] = element;
        size++;
    }

在上面这一段代码中可以看到添加有2个方法, 默认的是不带索引的添加, 而下面一个复写的方法是带索引的方法

  • boolean add(E e)

    这一个就是直接在数组的尾部添加一个元素, 但是在添加之前我们可以看方法上面有一个**ensureCapacityInternal(size + 1)**的这样一个方法, 这个方法是检验是否这个数组的大小能不能继续添加元素,如果不能, 那么就进行扩容操作, 扩容操作就是将当前数组的容量扩容一半。然后在尾部进行添加
/**
     * Increases the capacity to ensure that it can hold at least the
     * number of elements specified by the minimum capacity argument.
     *
     * @param minCapacity the desired minimum capacity
     */
    private void grow(int minCapacity) {
        // overflow-conscious code
        int oldCapacity = elementData.length;
        int newCapacity = oldCapacity + (oldCapacity >> 1);
        if (newCapacity - minCapacity < 0)
            newCapacity = minCapacity;
        if (newCapacity - MAX_ARRAY_SIZE > 0)
            newCapacity = hugeCapacity(minCapacity);
        // minCapacity is usually close to size, so this is a win:
        elementData = Arrays.copyOf(elementData, newCapacity);
    }

最主要的就是设置大小这里, 这里涉及到了位运算, 在这里我们可以看到,进行了右移操作

  • void add(int index, E element)

    这个方法就是将指定的对象插入到数组指定的位置当中去, 这个做法是非常消耗性能的, 如果说需要大量的这种指定插入的话, 建议的方法是用LinkedList, 链表(LinkedList)
删除元素
/**
     * Removes the element at the specified position in this list.
     * Shifts any subsequent elements to the left (subtracts one from their
     * indices).
     *
     * @param index the index of the element to be removed
     * @return the element that was removed from the list
     * @throws IndexOutOfBoundsException {@inheritDoc}
     */
    public E remove(int index) {
        rangeCheck(index);

        modCount++;
        E oldValue = elementData(index);

        int numMoved = size - index - 1;
        if (numMoved > 0)
            System.arraycopy(elementData, index+1, elementData, index,
                             numMoved);
        elementData[--size] = null; // clear to let GC do its work

        return oldValue;
    }

    /**
     * Removes the first occurrence of the specified element from this list,
     * if it is present.  If the list does not contain the element, it is
     * unchanged.  More formally, removes the element with the lowest index
     * <tt>i</tt> such that
     * <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o.equals(get(i)))</tt>
     * (if such an element exists).  Returns <tt>true</tt> if this list
     * contained the specified element (or equivalently, if this list
     * changed as a result of the call).
     *
     * @param o element to be removed from this list, if present
     * @return <tt>true</tt> if this list contained the specified element
     */
    public boolean remove(Object o) {
        if (o == null) {
            for (int index = 0; index < size; index++)
                if (elementData[index] == null) {
                    fastRemove(index);
                    return true;
                }
        } else {
            for (int index = 0; index < size; index++)
                if (o.equals(elementData[index])) {
                    fastRemove(index);
                    return true;
                }
        }
        return false;
    }
    
    /*
     * Private remove method that skips bounds checking and does not
     * return the value removed.
     */
    private void fastRemove(int index) {
        modCount++;
        int numMoved = size - index - 1;
        if (numMoved > 0)
            System.arraycopy(elementData, index+1, elementData, index,
                             numMoved);
        elementData[--size] = null; // clear to let GC do its work
    }

可以看到, 删除也是两个方法, 不过和添加不同, 默认的不是从尾部或者头部开始删除。而是说默认的是指定集合的下标开始删除。

  • E remove(int index)

    从指定的下标开始删除, 和插入的道理是相通的
  • boolean remove(Object o)

    这个方法的实现可以看一下, 这里面实现了一个如果传过来的是null,这个删除动作也会将数据为null的给删除掉。默认是用equals来进行比较。
  • void fastRemove(int index)
  • 可以看到,这个方法才是真正进行删除的方法, 是一个私有的方法, 实现的方式也很特别, 是通过拷贝方式来实现的, 我们可以来看一下这个方法。
    这里删除用了将后面一部分的元素替换了前面的一部分元素, 然后将结尾的删除掉
/*
     * @param      src      这个源数组
     * @param      srcPos   源数组启始的下标位置
     * @param      dest     目的地的数组
     * @param      destPos  目的地开始的下标位置
     * @param      length   需要拷贝多少个元素
     * @exception  IndexOutOfBoundsException  if copying would cause
     *               access of data outside array bounds.
     * @exception  ArrayStoreException  if an element in the <code>src</code>
     *               array could not be stored into the <code>dest</code> array
     *               because of a type mismatch.
     * @exception  NullPointerException if either <code>src</code> or
     *               <code>dest</code> is <code>null</code>.
     */
public static native void arraycopy(Object src,  int  srcPos,
                                        Object dest, int destPos,
                                        int length);
替换操作
@Override
    @SuppressWarnings("unchecked")
    public void replaceAll(UnaryOperator<E> operator) {
        Objects.requireNonNull(operator);
        final int expectedModCount = modCount;
        final int size = this.size;
        for (int i=0; modCount == expectedModCount && i < size; i++) {
            elementData[i] = operator.apply((E) elementData[i]);
        }
        if (modCount != expectedModCount) {
            throw new ConcurrentModificationException();
        }
        modCount++;
    }
  • void replaceAll(UnaryOperator operator)

    这里面的参数是1.8里面新加入的一个功能, lambda表达式, 又是一个函数式编程, 这里就不再说明函数式编程是啥, 这个参数的作用就是UnaryOperator传入两个相同类型的参数最终返回一个同类型的对象
遍历操作

在Collection类里面就已经继承了Iterable的这一个接口了, 这个接口里面有一个Iterator抽象方法

public interface Iterable<T> {
    
    Iterator<T> iterator();

    default void forEach(Consumer<? super T> action) {
        Objects.requireNonNull(action);
        for (T t : this) {
            action.accept(t);
        }
    }

    default Spliterator<T> spliterator() {
        return Spliterators.spliteratorUnknownSize(iterator(), 0);
    }
}

可以看见, 其他两个方法都是在1.8之后进行加入的默认方法, 可以默认不进行继承, 这个操作也是为了方便lambda表达式的使用而构建的, 具体去参考lambda函数式编程这一本书。
那么这个迭代器是干吗的呢?就是进行迭代的。。。

里面的类有兴趣自己去看看, 这里就不在进行深入去讲了,
回到ArrayList。

public Iterator<E> iterator() {
        return new Itr();
    }
/**
     * An optimized version of AbstractList.Itr
     */
    private class Itr implements Iterator<E> {
        int cursor;       // index of next element to return
        int lastRet = -1; // index of last element returned; -1 if no such
        int expectedModCount = modCount;

        public boolean hasNext() {
            return cursor != size;
        }

        @SuppressWarnings("unchecked")
        public E next() {
            checkForComodification();
            int i = cursor;
            if (i >= size)
                throw new NoSuchElementException();
            Object[] elementData = ArrayList.this.elementData;
            if (i >= elementData.length)
                throw new ConcurrentModificationException();
            cursor = i + 1;
            return (E) elementData[lastRet = i];
        }

        public void remove() {
            if (lastRet < 0)
                throw new IllegalStateException();
            checkForComodification();

            try {
                ArrayList.this.remove(lastRet);
                cursor = lastRet;
                lastRet = -1;
                expectedModCount = modCount;
            } catch (IndexOutOfBoundsException ex) {
                throw new ConcurrentModificationException();
            }
        }

        @Override
        @SuppressWarnings("unchecked")
        public void forEachRemaining(Consumer<? super E> consumer) {
            Objects.requireNonNull(consumer);
            final int size = ArrayList.this.size;
            int i = cursor;
            if (i >= size) {
                return;
            }
            final Object[] elementData = ArrayList.this.elementData;
            if (i >= elementData.length) {
                throw new ConcurrentModificationException();
            }
            while (i != size && modCount == expectedModCount) {
                consumer.accept((E) elementData[i++]);
            }
            // update once at end of iteration to reduce heap write traffic
            cursor = i;
            lastRet = i - 1;
            checkForComodification();
        }

        final void checkForComodification() {
            if (modCount != expectedModCount)
                throw new ConcurrentModificationException();
        }
    }
  • 私有的内部类有什么好处呢?

第一个就是可以访问外部的私有属性和其他属性, 因为自己也是外面的一部分。
第二就是外面可以进行实例化内部的类, 而在其他包里面是访问不到这个类的存在的。
详细的点击链接

  • boolean hasNext()

这个方法实现就是当前的位置是不是到头了?如果是,就返回false, 否则返回true

  • void remove()

    删除当前下标前一个元素, 而不是当前下标的元素。首先会判断当前的元素有没有迭代, 如果有迭代至少一次才能删除, 不然就是状态异常
    IllegalStateException, 接下来才会判断是否有无其他线程在操作。在java语言中, 如果内部类和主类有相同的方法名怎么办, 这时候就需要指定一个方法名this派上用场了,调用ArrayList.this.remove() 删除方法。最后要进行变量置等。

  • E next()

    看着个方法就知道是干嘛的, 这个方法就是返回当前下标的元素, 看看里面具体做了什么操作。

    1.checkForComodification(); 这个方法是干啥的呢?也就是说,在我用这个对象的时候, 对对象有添加或者删除这种更改数据行为的操作都是非法的!我们可以看看源码,modCount 这个字段就是做了操作就会进行递增, 如果当前expectedModCount 和 modCount不相等的话, 那么就会抛ConcurrentModificationException(其他线程修改异常), 那么我们要删除怎么办, 在迭代器提供了删除操作。往下看,就是常规的操作了

  • void forEachRemaining(Consumer<? super E> consumer)

    不得不说啊, 在1.8之后, 大量的采用了lambda的机制!可以看见,这个方法里面的参数是Consumer<? super E> consumer这里进行了类型限制, 并且这个类是一个消费者模型, 也就是说!这个对象就是拿来消费的!这个方法的作用就是从当前下标来进行遍历操作, 消费后面的元素。

增强版的遍历操作
/**
     * An optimized version of AbstractList.ListItr
     */
    private class ListItr extends Itr implements ListIterator<E> {
        ListItr(int index) {
            super();
            cursor = index;
        }

        public boolean hasPrevious() {
            return cursor != 0;
        }

        public int nextIndex() {
            return cursor;
        }

        public int previousIndex() {
            return cursor - 1;
        }

        @SuppressWarnings("unchecked")
        public E previous() {
            checkForComodification();
            int i = cursor - 1;
            if (i < 0)
                throw new NoSuchElementException();
            Object[] elementData = ArrayList.this.elementData;
            if (i >= elementData.length)
                throw new ConcurrentModificationException();
            cursor = i;
            return (E) elementData[lastRet = i];
        }

        public void set(E e) {
            if (lastRet < 0)
                throw new IllegalStateException();
            checkForComodification();

            try {
                ArrayList.this.set(lastRet, e);
            } catch (IndexOutOfBoundsException ex) {
                throw new ConcurrentModificationException();
            }
        }

        public void add(E e) {
            checkForComodification();

            try {
                int i = cursor;
                ArrayList.this.add(i, e);
                cursor = i + 1;
                lastRet = -1;
                expectedModCount = modCount;
            } catch (IndexOutOfBoundsException ex) {
                throw new ConcurrentModificationException();
            }
        }
    }

可以看继承结构就可以看得出来, 这个是在Itr内部类的基础之上而做出的增强版操作

1.允许初始化的时候任意指定下标位置

2.允许向前遍历

3.允许添加操作

4.允许更改操作

SubList子类

这个类的作用是用来截取当前集合中的一部分数据,但是你在这部分数据中进行操作,特别是那种影响结构的操作, 会直接影响到主集合, 所以操作的时候要小心,但是在网上有一个集合split的操作却是经典

/** Split a list into two sublists. The original list will be modified to
 * have size i and will contain exactly the same elements at indices 0 
 * through i-1 as it had originally; the returned list will have size 
 * len-i (where len is the size of the original list before the call) 
 * and will have the same elements at indices 0 through len-(i+1) as 
 * the original list had at indices i through len-1.
 */
<T> List<T> split(List<T> list, int i);
30、Java数组与ArrayList类的深入解析 本文深入解析了Java中的数组和ArrayList类,涵盖了多维数组的声明与应用、选择排序和二分查找算法的实现与对比、命令行参数和可变长度参数列表的使用,以及ArrayList类的操作方法与性能分析。同时,文章通过实际应用案例说明了这些技术在现实开发场景中的用途,并提供了详细的代码示例帮助读者理解和实践。适合Java初学者和进阶开发者参考学习。 阅读详情

相关推荐

33、Java数组与ArrayList类的深入解析

本文深入解析了Java中的数组和ArrayList类,涵盖了数组的声明、创建、元素操作、遍历、复制以及作为参数传递等内容。同时对比了普通for循环和增强for循环的使用场景及优缺点,帮助开发者更高效地处理数组相关任务。

beta5的博客 54

关于List中的坑(上)

以下为List 常见坑: 1.数组转换为List 通过Arrays.asList(T… a)将数组转换为List。如: 1.1不支持添加/删除元素 public class ArrayListTest { public static void main(String[] args) { String[] seasons = {"spring", "summer", "au...

菩提小猿的博客 580

27、Java数组与ArrayList类全解析

本文全面解析了Java中的数组和ArrayList类,涵盖数组的基本概念、声明与创建、元素访问与操作、边界检查、初始化方法、数组处理技巧等内容。通过详细的代码示例和应用场景分析,帮助读者掌握数组在实际开发中的使用方式。此外,还介绍了增强for循环与传统for循环的对比、常见错误及解决方法,助力编写高效、安全的数组操作代码。

dapp9builder的博客 108

Java | 泛型知识知多少?

什么是泛型 泛型就是在编译阶段执行的一种模版,例如ArrayList,在代码中为用到的类创建对应的ArrayList<类型> ArrayList<String> strList = new ArrayList<String>(); 既实现了编写一次,万能匹配,又通过编译器保证了强类型语言的类型安全:这就是泛型 向上转型 ArrayList可以向上转型为List<T>,因为ArrayList<T>实现了List<T>接口 publi

分享技术类相关知识点、技巧,和大家一起成长。 1083

Java源码解析之ArrayList类

java中ArrayList类的底层实现是什么样的?一篇文章帮你了解其底层原理,让你知其然,并知其所以然!

明天的地平线 355

Syzkaller实战教程2:运行环境配置+实例运行

本文详细介绍了在linux系统上搭建Syzkaller内核模糊测试环境的完整流程。 1.环境配置:通过VMware创建Ubuntu20.04虚拟机A,配置QEMU/KVM虚拟化环境,安装Go语言工具链和Syzkaller; 2.内核编译:下载Linux内核源码并配置KCOV等调试选项,编译生成带覆盖率支持的bzImage内核镜像; 3.测试环境构建:使用debootstrap创建Debian虚拟机镜像,通过QEMU启动嵌套虚拟机B; 实例测试: 4.演示两种测试场景 - 提供完整上手教程

cuguanren的博客 1375

jsp代码中ArrayList函数提示“无法解释为类型”

page指令缺少引用 import="java.util.*"     pageEncoding="UTF-8" %>

FeagleM的博客 4508

Linux系统下奥比中光Astra Pro相机SDK部署与避坑指南

本文详细指导了在Linux系统下部署奥比中光Astra Pro深度相机SDK的全过程,涵盖系统准备、SDK安装、设备权限配置及常见问题排查。重点解析了USB设备规则配置这一关键步骤,并提供了Python与C++项目的集成方法,旨在帮助开发者快速完成相机配置,避免常见陷阱。

weixin_28455801的博客 298

java找不到类list_java编译错误 找不到符号 类 ArrayList

classnoteimplementsSerializable{Stringname,phone,MobilePhone,zip,address,Email;publicvoidSetnote(Stringname,Stringphone,StringMobilePhone,Stringzip,Stringaddress,StringEm...class note implements Seria...

weixin_30747571的博客 2068

制作3D地形图的方法-使用GlobalMapper和3ds Max软件

打开GlobalMapper软件,在菜单栏中选择“文件”>“打开数据文件”,然后选择相应的高程数据文件。在菜单栏中选择“渲染”>“渲染设置”,根据需要进行设置,如分辨率和输出格式。选择地形对象,点击菜单栏中的“渲染”>“材质编辑器”,然后根据需要调整材质属性,如颜色、纹理和光照等。在菜单栏中选择“工具”>“高程栅格和网格”>“创建地形网格”。在菜单栏中选择“文件”>“导出”>“导出栅格格式”。打开3ds Max软件,在菜单栏中选择“文件”>“导入”,然后选择之前导出的地形数据文件。步骤3:导出地形网格。

JqlScala的博客 1535

PHP 网页游戏开发入门教程

我们还链接了一个名为 “game.js” 的 JavaScript 文件,稍后将在其中编写游戏逻辑。这只是一个简单的示例,但它演示了如何使用 PHP 和 JavaScript 开发一个基本的网页游戏。以下是一个示例游戏的源代码和解释。现在,您可以在浏览器中打开 “game.php” 文件,即可看到一个带有红色游戏角色的游戏板。在上述代码中,我们使用 JavaScript 创建了一个游戏角色元素,并将其添加到游戏板容器中。最后,我们需要将游戏元素的样式设置为绝对定位,以便能够正确地控制它们的位置。

KkowServer的博客 678

ArrayList类重要方法源码解析

ArrayList类重要方法源码解析: ArrayList的继承与属性 public class ArrayList extends AbstractList implements List, RandomAccess, Cloneable, java.io.Serializable { private static final long serialVersionUID = 8683452581...

weixin_44173793的博客 184

0 基础学前端:100 天拿 offer 实战课(第 16 天)—— JS 数组高级方法:数据处理效率翻倍,代码更简洁

方法名核心作用回调函数返回值返回结果适用场景map数据转换转换后的新元素新数组(长度与原数组一致)格式转换、新增字段、生成 DOM 字符串filter数据筛选true(保留)/false(过滤)新数组(符合条件的元素)筛选符合条件的元素(如未完成计划、今天的评论)reduce数据汇总新的累加值任意类型(数字、对象等)求和、计数、分组、多数据汇总find查找元素true(匹配)/false(不匹配)第一个匹配的元素 /undefined。

苏打水.X的博客 132

java解析arraylist_Java重要类详解之ArrayList类

https://blog.youkuaiyun.com/shengmingqijiquan/article/details/52634640一.ArrayList概述ArrayList 是一个数组队列,相当于动态数组。与Java中的数组相比,它的容量能动态增长。它继承于AbstractList,实现了List,RandomAccess[随机访问],Cloneable[可克隆],java.io.Seriali...

weixin_36200490的博客 327

YOLOv11改进策略【注意力机制篇】| SE、CBAM、ECA、CA、Swin Transformer等注意力机制全面解析与应用

本文详细介绍了五种主流的注意力机制及其在YOLOv11中的应用。通过合理的模块选择和位置部署,注意力机制能够显著提升目标检测性能。

QQ_778132974的博客 873

拼多多小球直径轨迹重合验证码识别

本文分析了拼多多新型验证码的实现原理与破解思路。该验证码采用Canvas绘制小球弹跳轨迹验证,主要难点在于参数还原和轨迹计算。作者通过逆向工程提取了包括弹跳段数、振幅、旋转参数等关键配置(存储在config.json),并利用Python成功模拟了验证过程。核心算法将滑块值映射为0-1区间,通过三次变换计算小球位置,最终采用斜率截距最小值比对完成验证。整个过程分为静态初始化、核心计算和动态渲染三个阶段,其中干扰元素不影响核心验证逻辑。该研究仅用于技术学习,强调严禁任何违法行为。

码王吴彦祖的博客 1323

【集合类】源码解析之 ArrayList类

大纲ArrayList重点字段构造函数扩容存储删除序列化和反序列化jdk1.8新增的方法实现其余方法 ArrayList 基于数组,线程不安全,随机存取,查询快增删慢,以1.5倍扩容,最大是Integer.MAX - 8 public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializable{ 重点字段 // 默

weixin_42598683的博客 254

GEE:本地影像上传到GEE的Assets中,并输入机器学习算法中作为特征变量

当我们在 Google Earth Engine(GEE)中应用机器学习算法时,会输入一些影像作为特征变量数据,进一步根据这些特征影像去推理未知区域的数据。但是 GEE 平台上计算特征变量的 API 函数并不是非常全面,我们希望获得更多的特征用于分类。这个时候,我们可以将本地计算的特征影像上传到 GEE 中进行后续处理。本文记录了从本地上传特征数据到 GEE 的 Assets 中的教程,用于后续在 GEE 中分类或者回归使用。本文也可作为《》一文的补充。

养乐多的博客 1730

ArrayList类解析以及部分常用方法分析

ArrayList类和LinkedList类依赖java.util.List接口; java.util.List接口继承自java.util.Collection接口; java.util.Collection继承自Iterable接口; 即ArrayList(数组表)和LinkedList(双向链表)可以使用List接口中的所有方法,List中的部分方法继承自Collection接口; 这边会具体介绍两个常用的集合实现类中的几个方法介绍以及应用场景。 int size(); 返回集合大小,如果集合中实际存

mm3930663的博客 307

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

ArrayList类源码解析

ArrayList特点: 1.内部通过数组实现 2.删除、插入元素需要大量移动元素 3.默认存储容量是null,需要增加容量时候,默认增加的容量等于原始ArrayList的容量 4.没有实现同步方法,多线程的时候,线程不安全,效率较高 5.存储元素的顺序就说加入集合中的顺序,方便指定index访问元素 所在包package java.util;继承AbstractList抽象类 实现

水滴石穿 1643

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

ArrayList类源码解析——ArrayList动态数组的实现细节(基于JDK8)

一、基本概念 ArrayList是一个可以添加对象元素,并进行元素的修改查询删除等操作的容器类。ArrayList底层是由数组实现的,所以和数组一样可以根据索引对容器对象所包含的元素进行快速随机的查询操作,其时间复杂度为O(1)。但是和数组不同的是,数组对象创建后数组长度是不变的,ArrayList对象创建后其长度是可变的,所以ArrayList也称为动态数...

weixin_30617797的博客 112

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

Java ArrayList类深度解析

针对以上面试题,小编已经把面试题+答案整理好了。

2401_83329402的博客 725
上一篇: javaJDK自带注解
LuFei_java
博客等级 码龄10年 1粉丝 30原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值