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);---->判断字符串相等,不区分大小写
    |
    获取功能

  • 相关阅读:
    webstorm-快捷键大全
    JavaScript-创建对象
    JavaScript-字符串的使用
    IE8 CSS hack
    jQuery-导航下拉菜单-实用简单
    jQuery-表格属性
    jQuery-图片轮播-随意切换图片
    jQuery-图片放大镜
    UVAlive3486_Cells
    SPOJ BOXES
  • 原文地址:https://www.cnblogs.com/tushao/p/14083250.html
Copyright © 2011-2022 走看看