1、ArrayList
java.util.ArrayList<E>
add(E e) //插入尾部
add(int index, E element)
remove(int index)
remove(Object o)
get(int index)
indexOf()
lastIndexOf()
isEmpty()
size()
iterator()
listIterator()
java.util 接口 Iterator<E>
hasNext()
next()
remove()
2、Arrays 和Collections工具类
System.arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
java.util.Arrays
static int binarySearch() //找不到则返回(-(插入点) - 1),不一定是-1。
static boolean equals() //判断数组相等
static void fill()
static void sort()
static <T> void sort(T[] a, Comparator<? super T> c)
java.util.Collections
static <T> int binarySearch(List<? extends Comparable<? super T>> list, T key)
max(Collection<? extends T> coll)
min(Collection<? extends T> coll)
static void reverse(List<?> list)
sort(List<T> list)
static <T> void sort(List<T> list, Comparator<? super T> c)
static <T> Comparator<T> reverseOrder() //重要
java.util.接口Comparator<T>
public interface Comparator<T> {
int compare(T o1, T o2);
boolean equals(Object obj);
}
java.lang.接口Comparable<T>
public interface Comparable<T> {
int compareTo(T o);
}
java.util.BitSet
BitSet()
BitSet(int nbits) //默认情况下,set中所有位的初始值都是false
void clear(int bitIndex) //将索引指定处的位设置为 false。
void clear() //将此 BitSet 中的所有位设置为 false。
void flip(int index) //反转指定位
boolean get(int index)
BitSet get(int from, int to)
boolean isEmpty() //当没有任何true位时,返回true
int length() //最高位索引+1(最高的1的索引,不是BitSet(10)中的9)
void set(int bitIndex) //将指定索引处的位设置为 true。
void set(int fromIndex, int toIndex, boolean value) //将指定的 fromIndex(包括)到指定的 toIndex(不包括)范围内的位设置为指定的值。
String toString() //返回字符串表示,bs.set(4);bs.set(6);之后为"{4,6}"
3、HashMap
java.util.HashMap<K, V>
boolean containsKey(Object key)
boolean containsValue(Object value)
Set<Map.Entry<K,V>> entrySet()
V get(Object key)
boolean isEmpty()
Set<K> keySet()
V put(K key, V value) //添加键值对,如果存在key,则替换value
V remove(Object key)
int size()
java.util.接口 Map.Entry<K,V> //是Map接口的静态内部接口
public static interface Map.Entry<K,V>
K getKey()
V getValue()
V setValue(V value)
4、HashSet
java.util.HashSet<E>
boolean add(E e)
boolean remove(Object o)
boolean contains(Object o)
boolean isEmpty()
int size()
Iterator<E> iterator()
5、LinkedList
java.util.LinkedList<E>
public class LinkedList<E> extends AbstractSequentialList<E>
implements List<E>, Deque<E>, Cloneable, Serializable
boolean add(E e) //加到末尾
void addFirst(E e)
void addLast(E e)
E removeFirst()
E removeLast()
E element() //获取但不移除头
E get(int index)
E getFirst()
E getLast()
int indexOf(Object o) //不包含则返回-1
int lastIndexOf(Object o) //不包含则返回-1
boolean contains(Object o)
int size()
Iterator<E> iterator()
E set(int index, E element)
6、Object
finalize()
clone()
3个wait()
notify()
notifyAll()
getClass()
equals()
hashCode()
toString()
一共11个方法!!
7、Pattern 和 Matcher
java.util.regex.Pattern
static Pattern compile(String regex)
static boolean matches(String regex, CharSequence input)
Matcher matcher(CharSequence input)
java.util.regex.Matcher
while(m.find()) {
String str1 = m.group();
String str2 = m.group(2);
boolean b1 = m.lookingAt(); //头部匹配
boolean b2 = m.matches();
}
int start() //以前匹配的初始索引
int end() //以前最后匹配字符之后一个字符的偏移量
Matcher reset() //重置匹配器
String replaceAll(String replacement) //替换模式与给定替换字符串相匹配的输入序列的每个子序列。
String replaceFirst(String replacement)
8、String
static Comparator<String> CASE_INSENSITIVE_ORDER;
charAt()
compareTo()
compareToIgnoreCase()
contains()
startsWith()
endsWith()
equals() //判断字符串相等不能用==
indexOf()
lastIndexOf()
isEmpty()
length()
matches(String regex)
replace()
replaceAll(String regex, String replacement)
replaceFirst(String regex, String replacement)
String[] split(String regex)
substring(int begin) //注意方法写法
substring(int begin, int end) //注意方法写法, end不包括
toLowerCase()
toUpperCase()
trim() //忽略前后的空白
9、StringBuilder
StringBuilder()
StringBuilder(String str)
append()
capacity() 与length()的区别!!建议忘了它吧!!
charAt()
delete(int start, int end) //不包含end
indexOf()
lastIndexOf()
insert(int offset, CharSequence s)
length()
reverse()
substring(int begin) //注意方法写法
substring(int begin, int end) //注意方法写法, end不包括
String toString()
没有没有equals()方法!!!!!!!!
没有没有equals()方法!!!!!!!!
没有没有equals()方法!!!!!!!!