2021-2-1
1.泛型概述
2.泛型类
package com.wc.collection;
/**
* @author wc
* @Date: 2021/02/01/10:56
*/
public class GenericDemo {
public static void main(String[] args) {
Generic<String> stringGeneric=new Generic<>();
stringGeneric.setT("橘子");
System.out.println(stringGeneric);
Generic<Integer> integerGeneric=new Generic<>();
integerGeneric.setT(100);
System.out.println(integerGeneric);
}
}
3.泛型方法
4.泛型接口
5.类型通配符
package com.wc.collection;
/**
* @author wc
* @Date: 2021/02/01/11:17
*/
public class GenericityDemo {
public static void main(String[] args) {
//未指定类型
Genericity genericity = new GenericityImpl1();
genericity.method("茶妮子");
//指定类型
Genericity genericity1=new GenericityImpl2();
genericity1.method("橘子");
}
}
interface Genericity<T> {
void method(T t);
}
class GenericityImpl1<T> implements Genericity<T> {
@Override
public void method(T t) {
System.out.println(t);
}
}
class GenericityImpl2<T> implements Genericity<String> {
@Override
public void method(String s) {
System.out.println(s);
}
}
6.数据结构-二叉树
7.数据结构-二叉查找树(添加节点)
8.数据结构-平衡二叉树(左旋,右旋)
左旋
右旋
9.红黑树(红黑规则(节点添加时默认是红色))
10.HashSet集合
11.哈希值(HashSet解析、存储流程)