队列
| 功能 | 函数 |
|---|---|
| 创建新的队列 | Queue<element> queue = new LinkedList<>(); |
| 判空 | queue.isEmpty() |
| queue.offer() | 添加元素,队列满时返回false |
| queue.poll() | 删除头顶元素,并返回值,若队列为空,返回null |
| queue.peek() | 返回头顶元素,若队列为空,返回null |
| queue.add() | 添加元素,队列满时返回异常IIIegaISlabEepeplian |
| queue.remove() | 删除头顶元素,并返回值,若队列为空,返回异常NoSuchElementException |
| queue.element() | 返回头顶元素,若队列为空,返回异常NoSuchElementException |
栈
| 功能 | 函数 |
|---|---|
常见函数
| 功能 | 函数 |
|---|---|
| int 转Integer类型 | Integer.valueOf(a) |
| 比较大小 | 字符串用equals,字符用== |
| 类型 | 函数 | 功能 |
|---|---|---|
| ArrayList列表 | 初始化 | List<T> list = new ArrayList<T>() |
| ArrayList<T> obj = new ArrayList<T>(Arrays.asList(o1, o2, …)) | ||
| 升序 | Collections.sort(list) | |
| 降序 | Collections.sort(list,Collections.reverseOrder()) | |
| 逆序 | Collections.reverse(list) | |
| 长度 | list.size() | |
| Array数组 | 逆序 | Collections.reverse(list) |
| 长度 | array.length |
2651

被折叠的 条评论
为什么被折叠?



