zoukankan      html  css  js  c++  java
  • 常用API方法

    Random:生成随机数
    1.生成随机整数:random.nextInt(n);------->[0,n-1)得整数
    2.生成随机小数:random.nextDouble(n);---->[0.0,n.0]得小数
    |||||||||||
    |||||||||||
    |||||||||||
    ArrayList集合
    1.arrayList.add(E e);----->在集合最后面加一个元素
    2.arrayList.add(int index,E e);---->在集合指定位置加数据
    3.arrayList.clear();---->清空集合
    4.arrayList.contains(E e);---->判断集合中是否有某元素
    5.arrayList.get(int index);---->获得指定下标的元素
    6.arrayList,indexOf(E e);---->返回第一次出现输入元素的位置
    7.arrayList.isEmpty();---->判断集合是否为空
    8.arrayList.remove(int index);---->删除指定位置元素
    9.arrayList.set(int index,E e);---->把指定位置元素替换为输入元素,并返回原元素
    10.arrayList.size();---->查看集合终元素个数
    11.用for循环遍历集合
    12.用foreach遍历集合
    13.用迭代器遍历集合(iterator.hasNext()和iterator.next());
    |||||||||||
    |||||||||||
    |||||||||||
    String:
    判断相等方法
    1.str1.equals(str2);---->判断字符串相等区分大小写
    2.str1.equalsIgnoreCase(str2);---->判断字符串相等,不区分大小写
    |
    获取功能

  • 相关阅读:
    vue /deep/ ::v-deep >>> 深度选择器
    雪碧图优缺点
    自适应高度文本框 react contenteditable
    textarea 高度自适应
    UMI.js开发知识总结
    flex布局下img图片变形的解决方法
    umi model 注册
    HEVC标准介绍
    《推荐系统》阅读笔记
    互联网名词诙谐解释
  • 原文地址:https://www.cnblogs.com/tushao/p/14083250.html
Copyright © 2011-2022 走看看