import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.TreeMap;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) throws IOException {
//输入输出流
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
log.flush();
//HashMap 赋值,查询
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
int val = 0;
map.put(val, map.getOrDefault(val, 0) + 1);
for(Map.Entry<Integer, Integer> entry : map.entrySet())
{
int a = entry.getKey();
int b = entry.getValue();
}
//TreeMap
TreeMap<Integer, Integer> map2 = new TreeMap<Integer, Integer>();
//HashSet
HashSet<Integer> set1 = new HashSet<Integer>();
//TreeSet
TreeSet<Integer> set2 = new TreeSet<Integer>();
int e = 1;
Integer l = set2.floor(e);//窗口中小于等于e的最大值,找不到返回null
Integer r = set2.ceiling(e);//窗口中大于等于e的最小值,找不到返回null
set2.remove(e);//具体移除某个值
//排序
int[] a = new int[18];
Integer[] b = new Integer[18];
int l = 2, r = 3;
//从小到大
Arrays.sort(a, l, r + 1);
//从大到小
Arrays.sort(b, l, r + 1, (x, y) -> {return y - x;});
//链表
List<Integer> ans = new ArrayList<Integer>();
//队列
Queue<Integer> q1 = new LinkedList<Integer>();
//双端队列
Deque<Integer> q2 = new LinkedList<Integer>();
//数组队列
ArrayList<Integer>[] head = new ArrayList[10];
for(int i = 0;i < 10;i ++) head[i] = new ArrayList<Integer>();
//优先队列
//小根堆
PriorityQueue<Integer> q3 = new PriorityQueue<Integer>();
//大根堆
PriorityQueue<Integer> q4 = new PriorityQueue<Integer>((x, y) -> {return y - x;});
}
}
class Edge implements Comparable<Edge>
{
int a, b, c;
Edge(int a, int b, int c)
{
this.a = a;
this.b = b;
this.c = c;
}
@Override
public int compareTo(Edge o) {
// TODO 自动生成的方法存根
return Integer.compare(c, o.c);
}
}
网友评论