数组
Array
dataType[] arrayRefVar = new dataType[arraySize]; //声明
dataType[] arrayRefVar = {value0, value1, ..., valuek}; //声明
int[] array2 = array1.clone(); //复制数组
arrayRefVar.length //长度
TestArrays.output(array); //打印数组
Arrays.fill(array, 5); //填充数组
Arrays.sort(array1, 2, 7); // 对数组的第2个到第6个进行排序进行升序排序
Arrays.sort(array1,Collections.reverseOrder()); //降序排序
Arrays.binarySearch(array1, 3); //二分查找数组
ArrayList
ArrayList<String> a = new ArrayList<>();
a.size();
a.add();
a.get();
a.set(1,"wiki");
a.remove(1);
Collections.sort(a);
Collections.reverse(a);
字符串
Character
int i = ch - '0';
String
String str2=new String("Runoob");
str2.length();
string1.concat(string2);
"Hello," + " runoob";
s1.charAt();
s1.indexOf();
String []temp = s1.split("-");
s1.substring(1,2);
s1.toCharArray();
int i = Integer.parseInt(s1);
StringBuilder
StringBuilder s = new StringBuilder(10);
s.append("123");
s.insert(2,"java");
s.delete(int start, int end);
s.capacity();
s.reverse();
s.toString();
Map
HashMap
HashMap<Integer,String> map = new HashMap<>();
map.size();
map.put(1,"Google");
putIfAbsent(1,"Google");
map.get(1);
map.remove(1);
map.clear();
map.containsKey();
map.containsValue();
Set
HashSet
HashSet<Integer> s = new HashSet<>();
s.size();
a.add();
a.remove();
s.contains(1);
Stack
Stack<Integer> st = new Stack<Integer>();
st.empty();
st.push(new Integer(1));
st.peek();
st.pop();
st.search();
Queue
Queue<String> q= new LinkedList<String>();
q.add();
q.poll();
q.peek();
PriorityQueue
PriorityQueue<Integer> minheap = new PriorityQueue<>();
PriorityQueue<Integer> maxheap = new PriorityQueue<>(k, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2.compareTo(o1);
}
});
其他操作同Queue。