
常用方法
文章平均质量分 52
zhuiyizhuiyi
这个作者很懒,什么都没留下…
展开
-
Arrays.asList
Arrays工具类提供了一些比较实用的方法,比如sort, binarySearch, fill等。其中还有一个asList方法,此方法能够将一个变长参数或者数组转换成List。 但是,这个生成的List,它是固定长度的,如果对其进行add或者remove的操作,会抛出UnsupportedOperationException,转载 2014-11-09 06:07:05 · 189 阅读 · 0 评论 -
Integer.parseInt(s, radix)
parseIntpublic static int parseInt(String s,int radix) throws NumberFormatExceptionParses the string argument as a signed integer in the radix specified by the second argument.转载 2015-01-19 05:00:08 · 573 阅读 · 1 评论 -
Iterator
import java.util.LinkedList;import java.util.List;import java.util.ListIterator;public class TestListIterator { public static void main(String args[]) { TestListIterator tliterator=new Test转载 2014-12-03 04:43:52 · 279 阅读 · 0 评论 -
String.trim
去掉字符串首尾空格 防止不必要的空格导致错误public class test{ public static void main(String[] args) { String str = " abc "; System.out.println(str.length());//输出6 System.out.println(str.trim().length());//输出3转载 2014-11-19 04:37:22 · 297 阅读 · 0 评论 -
String.split
输出为:Thislength:4islength:2anlength:2该段代码是为了测试String的split方法是否会保留字符串末尾的kong'ge原创 2014-11-16 08:21:12 · 221 阅读 · 0 评论 -
String(res, 2, 3)和s.substring(3)
public class Solution { public static void main(String args[]){ String s = "123456"; String s1 = s.substring(3); System.out.println("s1= " + s1); char[] res = new char[6]; res[0] = '1'; r原创 2014-11-17 09:18:09 · 5500 阅读 · 0 评论 -
String.toCharArray()
该方法的作用是返回一个字符数组,该字符数组中存放了当前字符串中的所有字符转载 2014-11-13 21:55:55 · 880 阅读 · 0 评论 -
Stack peek
查看栈顶对象而不移除它转载 2014-11-13 22:00:31 · 449 阅读 · 0 评论 -
LinkedList常用方法
/** * LinkedList:特有方法 * * addFirst() * addLast() * * getFist() * getLast() * 获取元素 但不删除元素 ,如果集合中没有元素,会出现 NoSuchException * * removeFirst() * removeLast() * 也可以获取元转载 2014-11-10 09:07:48 · 6542 阅读 · 0 评论 -
== equals和Arrays.equals
equalspublic boolean equals(Object obj)Indicates whether some other object is "equal to" this one.The equals method implements an equivalence relation on non-null object references:It is r原创 2015-01-20 06:07:34 · 764 阅读 · 0 评论