xerga 1 年之前
父節點
當前提交
2f6ec6571d
共有 69 個文件被更改,包括 3006 次插入5 次删除
  1. 4 5
      JavaSE/.idea/misc.xml
  2. 5 0
      JavaSE/.idea/modules.xml
  3. 11 0
      JavaSE/day14/day14.iml
  4. 86 0
      JavaSE/day14/src/com/lc/day14/coll01/TestColl.java
  5. 57 0
      JavaSE/day14/src/com/lc/day14/coll02/Test02.java
  6. 49 0
      JavaSE/day14/src/com/lc/day14/coll02/Test03.java
  7. 29 0
      JavaSE/day14/src/com/lc/day14/ex/Test.java
  8. 47 0
      JavaSE/day14/src/com/lc/day14/ex2/Student.java
  9. 62 0
      JavaSE/day14/src/com/lc/day14/ex2/Test.java
  10. 46 0
      JavaSE/day14/src/com/lc/day14/ex2/Test04.java
  11. 21 0
      JavaSE/day15/day15.iml
  12. 98 0
      JavaSE/day15/src/com/lc/day15/list01/Test01.java
  13. 70 0
      JavaSE/day15/src/com/lc/day15/list02/Student.java
  14. 78 0
      JavaSE/day15/src/com/lc/day15/list02/Test.java
  15. 28 0
      JavaSE/day15/src/com/lc/day15/list03/Test01.java
  16. 39 0
      JavaSE/day15/src/com/lc/day15/list03/Test02.java
  17. 52 0
      JavaSE/day15/src/com/lc/day15/list03/Test03.java
  18. 34 0
      JavaSE/day15/src/com/lc/day15/set04/TestSet.java
  19. 54 0
      JavaSE/day15/src/com/lc/day15/set05/Person.java
  20. 30 0
      JavaSE/day15/src/com/lc/day15/set05/Test.java
  21. 46 0
      JavaSE/day15/src/com/lc/day15/set06/Person.java
  22. 46 0
      JavaSE/day15/src/com/lc/day15/set06/Test.java
  23. 30 0
      JavaSE/day15/src/com/lc/day15/set06/Test01.java
  24. 39 0
      JavaSE/day15/src/com/lc/day15/set06/Test02.java
  25. 30 0
      JavaSE/day15/src/com/lc/day15/set07/Test.java
  26. 32 0
      JavaSE/day15/src/com/lc/day15/set08/Person.java
  27. 28 0
      JavaSE/day15/src/com/lc/day15/set08/TestTree.java
  28. 34 0
      JavaSE/day15/src/com/lc/day15/set08/TestTree1.java
  29. 33 0
      JavaSE/day15/src/com/lc/day15/set08/TestTree2.java
  30. 59 0
      JavaSE/day15/src/com/lc/day15/set09/Employee.java
  31. 54 0
      JavaSE/day15/src/com/lc/day15/set09/MyDate.java
  32. 53 0
      JavaSE/day15/src/com/lc/day15/set09/Test.java
  33. 50 0
      JavaSE/day15/src/com/lc/day15/set09/Test01.java
  34. 11 0
      JavaSE/day16/day16.iml
  35. 60 0
      JavaSE/day16/src/com/lc/day16/coll06/Test.java
  36. 45 0
      JavaSE/day16/src/com/lc/day16/coll06/Test1.java
  37. 46 0
      JavaSE/day16/src/com/lc/day16/coll06/Test2.java
  38. 34 0
      JavaSE/day16/src/com/lc/day16/list07/Person.java
  39. 46 0
      JavaSE/day16/src/com/lc/day16/list07/Test.java
  40. 22 0
      JavaSE/day16/src/com/lc/day16/list07/Test1.java
  41. 23 0
      JavaSE/day16/src/com/lc/day16/list07/Test2.java
  42. 23 0
      JavaSE/day16/src/com/lc/day16/list07/Test4.java
  43. 24 0
      JavaSE/day16/src/com/lc/day16/map01/Person.java
  44. 144 0
      JavaSE/day16/src/com/lc/day16/map01/TestMap01.java
  45. 38 0
      JavaSE/day16/src/com/lc/day16/map02/Test.java
  46. 45 0
      JavaSE/day16/src/com/lc/day16/map03/Test.java
  47. 38 0
      JavaSE/day16/src/com/lc/day16/map04/Test.java
  48. 40 0
      JavaSE/day16/src/com/lc/day16/map05/Test.java
  49. 11 0
      JavaSE/day17/day17.iml
  50. 80 0
      JavaSE/day17/src/com/lc/day16/homework/Test01.java
  51. 62 0
      JavaSE/day17/src/com/lc/day16/homework/Test02.java
  52. 18 0
      JavaSE/day17/src/com/lc/homework/day17/thread/Test01.java
  53. 18 0
      JavaSE/day17/src/com/lc/homework/day17/thread1/MyThread.java
  54. 18 0
      JavaSE/day17/src/com/lc/homework/day17/thread1/MyThread2.java
  55. 32 0
      JavaSE/day17/src/com/lc/homework/day17/thread1/Test.java
  56. 30 0
      JavaSE/day17/src/com/lc/homework/day17/thread2/Test.java
  57. 36 0
      JavaSE/day17/src/com/lc/homework/day17/thread3/Test.java
  58. 99 0
      JavaSE/day17/src/com/lc/homework/day17/thread3/Test2.java
  59. 56 0
      JavaSE/day17/src/com/lc/homework/day17/thread4/Test.java
  60. 79 0
      JavaSE/day17/src/com/lc/homework/day17/thread5/Test.java
  61. 52 0
      JavaSE/day17/src/com/lc/homework/day17/thread5/Test1.java
  62. 52 0
      JavaSE/day17/src/com/lc/homework/day17/thread6/Test.java
  63. 91 0
      JavaSE/day17/src/com/lc/homework/day17/thread6/Tikcet.java
  64. 55 0
      JavaSE/day17/src/com/lc/homework/day17/thread7/Test.java
  65. 11 0
      JavaSE/day_test/day_test.iml
  66. 65 0
      JavaSE/day_test/src/com/lc/day/MyClassLoaderTest.java
  67. 17 0
      JavaSE/day_test/src/com/lc/day/Test.java
  68. 36 0
      JavaSE/day_test/src/com/lc/day/TestDynamicLoad.java
  69. 15 0
      JavaSE/day_test/src/com/lc/day/TestJDKClassLoader.java

+ 4 - 5
JavaSE/.idea/misc.xml

@@ -1,6 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
-    <output url="file://$PROJECT_DIR$/out" />
-  </component>
+<project version="4">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/out" />
+  </component>
 </project>

+ 5 - 0
JavaSE/.idea/modules.xml

@@ -16,6 +16,11 @@
       <module fileurl="file://$PROJECT_DIR$/day11/day11.iml" filepath="$PROJECT_DIR$/day11/day11.iml" />
       <module fileurl="file://$PROJECT_DIR$/day12/day12.iml" filepath="$PROJECT_DIR$/day12/day12.iml" />
       <module fileurl="file://$PROJECT_DIR$/day13/day13.iml" filepath="$PROJECT_DIR$/day13/day13.iml" />
+      <module fileurl="file://$PROJECT_DIR$/day14/day14.iml" filepath="$PROJECT_DIR$/day14/day14.iml" />
+      <module fileurl="file://$PROJECT_DIR$/day15/day15.iml" filepath="$PROJECT_DIR$/day15/day15.iml" />
+      <module fileurl="file://$PROJECT_DIR$/day16/day16.iml" filepath="$PROJECT_DIR$/day16/day16.iml" />
+      <module fileurl="file://$PROJECT_DIR$/day17/day17.iml" filepath="$PROJECT_DIR$/day17/day17.iml" />
+      <module fileurl="file://$PROJECT_DIR$/day_test/day_test.iml" filepath="$PROJECT_DIR$/day_test/day_test.iml" />
     </modules>
   </component>
 </project>

+ 11 - 0
JavaSE/day14/day14.iml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 86 - 0
JavaSE/day14/src/com/lc/day14/coll01/TestColl.java

@@ -0,0 +1,86 @@
+package com.lc.day14.coll01;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.function.Predicate;
+
+/**
+ * ClassName: TestColl
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/10 10:12
+ * @Version 1.0
+ */
+public class TestColl {
+
+    /*
+     * `public boolean add(E e)`:  把给定的对象添加到当前集合中 。
+     * `public void clear()` :清空集合中所有的元素。
+     * `public boolean remove(E e)`: 把给定的对象在当前集合中删除。
+     * `public boolean contains(Object obj)`: 判断当前集合中是否包含给定的对象。
+     * `public boolean isEmpty()`: 判断当前集合是否为空。
+     * `public int size()`: 返回集合中元素的个数。
+     * `public Object[] toArray()`: 把集合中的元素,存储到数组中
+     * default boolean removeIf(Predicate<? super E> filter) 删除此集合中满足给定谓词的所有元素。
+     */
+    public static void main(String[] args) {
+        //容器
+        Collection coll = new ArrayList();
+
+        coll.add(456);
+        coll.add("123");
+        coll.add(new Object()); // 4eec7777
+        coll.add(new Double(1.0));
+        coll.add("zs");
+
+        System.out.println(coll);
+
+        //clear
+        //coll.clear();
+        //System.out.println(coll);
+
+        //remove
+        boolean remove = coll.remove("zs");
+        System.out.println(coll);
+
+//        Object o = new Object();
+//        System.out.println(o); //41629346
+//        coll.remove(o);
+//        System.out.println(coll); //
+
+        //contains
+        boolean contains = coll.contains(123);
+        System.out.println(contains);
+
+        //isEmpty
+        boolean empty = coll.isEmpty();
+        System.out.println(empty);
+
+        //size
+        System.out.println(coll.size());
+
+        //toArray
+        Object[] array = coll.toArray();
+
+        for (int i = 0; i < array.length; i++) {
+            System.out.println(array[i]);
+        }
+
+        //removeIf(Predicate<? super E> filter)
+        //Predicate 判断
+        //boolean test(T t); 返回true 删除 或者 false 不删除 传入实现规则
+
+
+        coll.removeIf(new Predicate() {
+            @Override
+            public boolean test(Object object) {
+                if (object.equals("123")){
+                    return true;
+                }
+                return false;
+            }
+        });
+
+        System.out.println(coll);
+    }
+}

+ 57 - 0
JavaSE/day14/src/com/lc/day14/coll02/Test02.java

@@ -0,0 +1,57 @@
+package com.lc.day14.coll02;
+
+import com.lc.day14.ex2.Student;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.function.Predicate;
+
+/**
+ * ClassName: Test02
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/10 11:31
+ * @Version 1.0
+ */
+public class Test02 {
+
+    public static void main(String[] args) {
+        //泛型 指定泛型 只能添加指定的泛型类型
+        //将运行期问题在编译器解决
+        Collection<String> list = new ArrayList<>();
+
+        list.add("1");
+        list.add("2");
+        list.add("3");
+        list.add("4");
+        list.add("5");
+
+        //迭代器
+        Iterator<String> iterator = list.iterator();
+
+        // hasNext 判断  next  获取
+        while (iterator.hasNext()){
+            String s = iterator.next();
+            System.out.println(s);
+        }
+
+
+        // foreach
+        for ( String e : list){
+            System.out.println(e);
+        }
+
+
+        //泛型
+        Collection<Student> c1 = new ArrayList();
+        c1.add(new Student());
+        c1.removeIf(new Predicate<Student>() {
+            @Override
+            public boolean test(Student student) {
+                return false;
+            }
+        });
+
+    }
+}

+ 49 - 0
JavaSE/day14/src/com/lc/day14/coll02/Test03.java

@@ -0,0 +1,49 @@
+package com.lc.day14.coll02;
+
+import com.lc.day14.ex2.Student;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.function.Predicate;
+
+/**
+ * ClassName: Test02
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/10 11:31
+ * @Version 1.0
+ */
+public class Test03 {
+
+    public static void main(String[] args) {
+       Collection<Integer> list = new ArrayList<>();
+
+        list.add(111);
+        list.add(222);
+        list.add(333);
+
+        //增强for原理是迭代器  使用迭代器 不可以在使用原集合操作 元素。
+//        for (Integer i : list) {
+//            if (i.equals(222)){
+//                list.remove(i);
+//            }
+//        }
+
+        //ConcurrentModificationException 并发修改异常
+
+
+        //在迭代器 内部 有删除方法。
+        Iterator<Integer> iterator = list.iterator();
+
+        while (iterator.hasNext()){
+            Integer next = iterator.next();
+            if (next == 111){
+                iterator.remove();
+            }
+        }
+
+        System.out.println(list);
+
+    }
+}

+ 29 - 0
JavaSE/day14/src/com/lc/day14/ex/Test.java

@@ -0,0 +1,29 @@
+package com.lc.day14.ex;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/10 9:35
+ * @Version 1.0
+ */
+public class Test {
+    public static void main(String[] args) {
+        int i = 1;
+        Integer j = new Integer(2); // 0x1133
+        Circle c = new Circle(); // 0x1166 radius
+        change(i,j,c);
+        System.out.println("i = " + i); // 1 1 1 1
+        System.out.println("j = " + j); // 2 1 2 2
+        System.out.println("c.radius = " + c.radius); // 10 20 2 10 10
+    }
+
+    public static void change(int a ,Integer b,Circle c ){ //b = 0x1133 = 2
+        a += 10;
+        b = 20; // 0x1133 = 20  // Integer.valueOf(20) = new Integer(20) 0x1144
+        c.radius += 10; //0x1166.radius
+    }
+}
+class Circle{
+    double radius;
+}

+ 47 - 0
JavaSE/day14/src/com/lc/day14/ex2/Student.java

@@ -0,0 +1,47 @@
+package com.lc.day14.ex2;
+
+/**
+ * ClassName: Student
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/10 11:07
+ * @Version 1.0
+ */
+public class Student {
+
+    private String name;
+
+    private int age;
+
+    public Student() {
+    }
+
+    public Student(String name, int age) {
+        this.name = name;
+        this.age = age;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getAge() {
+        return age;
+    }
+
+    public void setAge(int age) {
+        this.age = age;
+    }
+
+    @Override
+    public String toString() {
+        return "Student{" +
+                "name='" + name + '\'' +
+                ", age=" + age +
+                '}';
+    }
+}

+ 62 - 0
JavaSE/day14/src/com/lc/day14/ex2/Test.java

@@ -0,0 +1,62 @@
+package com.lc.day14.ex2;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.function.Predicate;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/10 11:07
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+        //集合
+        Collection coll = new ArrayList();
+
+        coll.add(new Student("zs",18));
+        coll.add(new Student("ls",19));
+        coll.add(new Student("ww",20));
+        coll.add(new Student("zl",12));
+        coll.add(new Student("kk",16));
+
+
+        // 判断是否为空
+        if (!coll.isEmpty()){
+            Object[] array = coll.toArray();
+
+            for (int i = 0; i < array.length; i++) {
+                //强制
+                Student s = (Student) array[i];
+                //zs
+                boolean equals = s.getName().equals("zs");
+                if (equals){
+                    //删除
+                    coll.remove(array[i]);
+                }
+            }
+        }
+
+        //查看
+        System.out.println(coll);
+
+
+        coll.removeIf(new Predicate() {
+            @Override
+            public boolean test(Object object) {
+                Student s1 = (Student) object;
+
+                if (s1.getAge() >= 18){
+                    return true;
+                }
+                return false;
+            }
+        });
+
+        System.out.println(coll);
+
+    }
+}

+ 46 - 0
JavaSE/day14/src/com/lc/day14/ex2/Test04.java

@@ -0,0 +1,46 @@
+package com.lc.day14.ex2;
+
+import com.lc.day14.ex2.Student;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.function.Predicate;
+
+/**
+ * ClassName: Test04
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/10 11:50
+ * @Version 1.0
+ */
+public class Test04 {
+    public static void main(String[] args) {
+        Collection<Student> person=new ArrayList();
+        person.add(new Student("zs",15));
+        person.add(new Student("ls",21));
+        person.add(new Student("ww",17));
+        person.add(new Student("ll",23));
+        person.add(new Student("rr",17));
+        Object[] student=person.toArray();
+        for (int i = 0; i < 5; i++) {
+            System.out.println(student[i]);
+        }
+        System.out.println("删除前");
+
+        for (int i = 0; i < 5; i++) {
+            System.out.println(person);
+        }
+        person.removeIf(new Predicate<Student>() {
+            @Override
+            public boolean test(Student a) {
+                Student b=(Student)a;
+                if(b.getAge()>=18||b.getName().equals("zs"))
+                    return true;
+                else
+                    return false;
+            }
+        }) ;
+
+        System.out.println(person);
+    }
+}

+ 21 - 0
JavaSE/day15/day15.iml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module-library">
+      <library name="JUnit4">
+        <CLASSES>
+          <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.1/junit-4.13.1.jar!/" />
+          <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+  </component>
+</module>

+ 98 - 0
JavaSE/day15/src/com/lc/day15/list01/Test01.java

@@ -0,0 +1,98 @@
+package com.lc.day15.list01;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.function.UnaryOperator;
+
+/**
+ * ClassName: Test01
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 9:32
+ * @Version 1.0
+ */
+public class Test01 {
+
+    public static void main(String[] args) {
+        List<Integer> list = new ArrayList<>();
+
+        //添加
+        list.add(0,111);
+        //索引必须递增 不能跳过
+        list.add(1,222);
+
+        list.add(333);
+
+
+        //get(int index) 根据元素获取
+        Integer i = list.get(1);
+        System.out.println(i);
+
+
+        //remove(int index) 根据索引删除
+        list.remove(1); //重载
+
+        System.out.println(list);
+
+        //修改
+        Integer set = list.set(1, 222222);
+
+        System.out.println(list);
+
+        //
+        List list1 = new ArrayList<>();
+        list1.add(1);
+        list1.add(2);
+        list1.add(3);
+
+        List<Integer> list2 = new ArrayList<>();
+        list2.add(4);
+        list2.add(5);
+        list2.add(6);
+
+        //list1.addAll(list2); //添加所有的元素
+        //list1.add(list2); //添加一个元素
+
+        System.out.println(list1);
+
+        //集合不可变
+        List<Integer> integers = List.of(1, 2, 3);
+
+       // boolean add = integers.add(4);
+
+        //迭代器
+        ListIterator<Integer> integerListIterator = integers.listIterator();
+
+        //前一个
+        boolean b = integerListIterator.hasPrevious();
+
+
+        //`replaceAll
+
+        List<Integer> list3 = new ArrayList<>();
+
+        list3.add(1);
+        list3.add(2);
+        list3.add(3);
+        list3.add(4);
+
+        //UnaryOperator
+        list3.replaceAll(new UnaryOperator<Integer>() {
+            @Override
+            public Integer apply(Integer integer) {
+
+                //integer 每一个元素 +10
+                int i1 = integer + 10;
+
+                return i1;
+            }
+        });
+
+
+        System.out.println(list3);
+
+    }
+
+}

+ 70 - 0
JavaSE/day15/src/com/lc/day15/list02/Student.java

@@ -0,0 +1,70 @@
+package com.lc.day15.list02;
+
+/**
+ * ClassName: Student
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 10:30
+ * @Version 1.0
+ */
+public class Student {
+
+    //学号,姓名,年龄,成绩
+
+    private Integer id;
+    private String name;
+    private Integer age;
+    private Double score;
+
+    public Student() {
+    }
+
+    public Student(Integer id, String name, Integer age, Double score) {
+        this.id = id;
+        this.name = name;
+        this.age = age;
+        this.score = score;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getAge() {
+        return age;
+    }
+
+    public void setAge(Integer age) {
+        this.age = age;
+    }
+
+    public Double getScore() {
+        return score;
+    }
+
+    public void setScore(Double score) {
+        this.score = score;
+    }
+
+    @Override
+    public String toString() {
+        return "Student{" +
+                "id=" + id +
+                ", name='" + name + '\'' +
+                ", age=" + age +
+                ", score=" + score +
+                '}';
+    }
+}

+ 78 - 0
JavaSE/day15/src/com/lc/day15/list02/Test.java

@@ -0,0 +1,78 @@
+package com.lc.day15.list02;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.function.UnaryOperator;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 10:32
+ * @Version 1.0
+ */
+public class Test {
+    public static void main(String[] args) {
+
+
+        List<Student> ss = new ArrayList<>();
+
+        ss.add(new Student(1,"张三", 20,66.0));
+        ss.add(new Student(2,"坤坤", 22,86.2));
+        ss.add(new Student(3,"凡凡", 18,96.0));
+        ss.add(new Student(4,"李四", 26,95.0));
+        ss.add(new Student(5,"韩梅梅", 17,16.0));
+        ss.add(new Student(6,"李雷", 20,26.0));
+
+        for (Student s : ss) {
+            System.out.println(s);
+        }
+
+        //找出成绩最高的学院删除 , 找出成绩最低的学员删除。
+        //排序
+        ss.sort(new Comparator<Student>() {
+            @Override
+            public int compare(Student o1, Student o2) {
+                return o1.getScore().compareTo(o2.getScore());
+            }
+        });
+
+        System.out.println("---------------");
+
+        for (Student s : ss) {
+            System.out.println(s);
+        }
+
+        //删除第一个  最后一个
+
+        ss.remove(0);
+        ss.remove(ss.size() - 1);
+
+        System.out.println("---------------");
+
+        for (Student s : ss) {
+            System.out.println(s);
+        }
+
+        ss.replaceAll(new UnaryOperator<Student>() {
+            @Override
+            public Student apply(Student student) { //0x1122
+
+                student.setScore(student.getScore()+10);
+
+                if (student.getScore() > 100){
+                    student.setScore(100.0);
+                }
+                return student;
+            }
+        });
+
+        System.out.println("---------------");
+
+        for (Student s : ss) {
+            System.out.println(s);
+        }
+
+    }
+}

+ 28 - 0
JavaSE/day15/src/com/lc/day15/list03/Test01.java

@@ -0,0 +1,28 @@
+package com.lc.day15.list03;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * ClassName: Test01
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 10:49
+ * @Version 1.0
+ */
+public class Test01 {
+
+    public static void main(String[] args) {
+
+        // 创建的数组 长度 0
+        List<String> list = new ArrayList<>();
+
+        // 指定容量 this.elementData = new Object[initialCapacity];
+        List list1 = new ArrayList<>(20);
+
+        //元素
+        List list2 = new ArrayList(List.of(1,2,3,4,5,6,7));
+        list2.add(8);
+    }
+
+}

+ 39 - 0
JavaSE/day15/src/com/lc/day15/list03/Test02.java

@@ -0,0 +1,39 @@
+package com.lc.day15.list03;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * ClassName: Test01
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 10:49
+ * @Version 1.0
+ */
+public class Test02 {
+
+    public static void main(String[] args) {
+        LinkedList<Integer> linkedList = new LinkedList<>();
+
+        linkedList.addFirst(11);
+        linkedList.addFirst(22);
+        linkedList.addFirst(33);
+
+        //33 22 11
+
+        //栈
+        Integer first = linkedList.getFirst();
+        System.out.println(first);
+
+        //队列
+        Integer last = linkedList.getLast();
+        System.out.println(last);
+
+        //连接池
+        //除雪 工具箱  按照顺序。
+
+
+    }
+
+}

+ 52 - 0
JavaSE/day15/src/com/lc/day15/list03/Test03.java

@@ -0,0 +1,52 @@
+package com.lc.day15.list03;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * ClassName: Test03
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 11:01
+ * @Version 1.0
+ */
+public class Test03 {
+
+    public static void main(String[] args) {
+
+        Vector<Integer> vector = new Vector<>();
+
+        vector.add(1); //synchronized 线程安全的
+        vector.add(2);
+        vector.add(3);
+
+        Enumeration<Integer> elements = vector.elements();
+
+        while (elements.hasMoreElements()){
+            Integer i = elements.nextElement();
+            System.out.println(i);
+        }
+
+
+
+    }
+
+    @Test
+    public void testListRemove() {
+        List list = new ArrayList(); //0x1122
+        list.add(1);
+        list.add(2);
+        list.add(3);
+        updateList(list);
+        System.out.println(list);// 123 12 123 12   // 12
+    }
+
+    private static void updateList(List list) { // 0x1122
+        list.remove(2);  // 索引
+    }
+
+}

+ 34 - 0
JavaSE/day15/src/com/lc/day15/set04/TestSet.java

@@ -0,0 +1,34 @@
+package com.lc.day15.set04;
+
+import java.util.HashSet;
+
+/**
+ * ClassName: TestSet
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 11:37
+ * @Version 1.0
+ */
+public class TestSet {
+
+    public static void main(String[] args) {
+
+        HashSet set = new HashSet<>();
+
+        /*
+        - 它不保证集合的迭代顺序;
+        - 此类允许`null`元素
+        - 不可重复
+         */
+        set.add(1);
+        set.add(1);
+        set.add(2);
+        set.add(null);
+        set.add(3);
+        set.add(4);
+
+        System.out.println(set);
+
+
+    }
+}

+ 54 - 0
JavaSE/day15/src/com/lc/day15/set05/Person.java

@@ -0,0 +1,54 @@
+package com.lc.day15.set05;
+
+import java.util.Objects;
+import java.util.Random;
+
+/**
+ * ClassName: Person
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 11:43
+ * @Version 1.0
+ */
+public class Person {
+
+    String name;
+    int age;
+
+    public Person(String name, int age) {
+        this.name = name;
+        this.age = age;
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        Person p = (Person) object;
+        boolean result = this.name.equals(p.name);
+        result = result && (this.age == p.age);
+        return result;
+    }
+
+
+    /*
+        总结:
+            添加 返回是否返回相同的hashcode 判断是否调用equals。
+            返回的hashcode 相同调用equals 否则不调用,直接添加
+                不同的hashcode 不是相同对象。
+
+            相同 equals
+                相同的hashcode 对象 可能相同的。比较内容。equals 返回true 相同 返回 false 不相同。
+     */
+    @Override
+    public int hashCode() {
+        //return new Random().nextInt();
+        return 1;
+    }
+
+    @Override
+    public String toString() {
+        return "Person{" +
+                "name='" + name + '\'' +
+                ", age=" + age +
+                '}';
+    }
+}

+ 30 - 0
JavaSE/day15/src/com/lc/day15/set05/Test.java

@@ -0,0 +1,30 @@
+package com.lc.day15.set05;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 11:44
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+
+        //hashcode  equalus
+
+        Set<Person> set = new HashSet<>();
+
+        //使用地址
+        set.add(new Person("a", 1));
+        set.add(new Person("a", 2));
+        set.add(new Person("a", 2));
+
+        //改变存储 判断
+        System.out.println(set);
+
+    }
+}

+ 46 - 0
JavaSE/day15/src/com/lc/day15/set06/Person.java

@@ -0,0 +1,46 @@
+package com.lc.day15.set06;
+
+import java.util.Objects;
+
+/**
+ * ClassName: Person
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 14:07
+ * @Version 1.0
+ */
+public class Person {
+
+    int id;
+    String name;
+
+    public Person(int id, String name) {
+        this.id = id;
+        this.name = name;
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (this == object) return true;
+        if (object == null || getClass() != object.getClass()) return false;
+        Person person = (Person) object;
+        return id == person.id && Objects.equals(name, person.name);
+    }
+
+
+    @Override
+    public int hashCode() {
+        // hashcode 是通过 id, name 生成的
+        int hash = Objects.hash(id, name);
+        System.out.println("hash :"+hash);
+        return Objects.hash(id, name);
+    }
+
+    @Override
+    public String toString() {
+        return "Person{" +
+                "id=" + id +
+                ", name='" + name + '\'' +
+                '}';
+    }
+}

+ 46 - 0
JavaSE/day15/src/com/lc/day15/set06/Test.java

@@ -0,0 +1,46 @@
+package com.lc.day15.set06;
+
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 13:38
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+        //编写一个程序,获取10个1至20的随机数,要求随机数不能重复。并把最终的随机数输出到控制台。
+        Set<Integer> number = get10Number();
+
+        System.out.println(number);
+
+        //获取 20 20-40;
+        Set<Integer> number1 = getNumber(15, 20, 40);
+        System.out.println(number1);
+
+    }
+
+    public static Set<Integer> getNumber(int count ,int start, int end){
+        Set<Integer> set = new HashSet<>();
+
+        while (set.size() != count){
+            set.add( new Random().nextInt(end - start) +start);
+        }
+        return set;
+    }
+
+    public static Set<Integer> get10Number(){
+        Set<Integer> set = new HashSet<>();
+
+        while (set.size() != 10){
+            set.add( new Random().nextInt(20) +1);
+        }
+        return set;
+    }
+
+}

+ 30 - 0
JavaSE/day15/src/com/lc/day15/set06/Test01.java

@@ -0,0 +1,30 @@
+package com.lc.day15.set06;
+
+import java.util.*;
+
+/**
+ * ClassName: Test01
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 14:02
+ * @Version 1.0
+ */
+public class Test01 {
+    public static void main(String[] args) {
+
+        Scanner scanner = new Scanner(System.in);
+
+        String next = scanner.next();
+
+        char[] charArray = next.toCharArray();
+
+        Set<Character> set = new HashSet<>();
+
+        for (char c : charArray) {
+            set.add(c);
+        }
+
+        System.out.println(set);
+
+    }
+}

+ 39 - 0
JavaSE/day15/src/com/lc/day15/set06/Test02.java

@@ -0,0 +1,39 @@
+package com.lc.day15.set06;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Scanner;
+import java.util.Set;
+
+/**
+ * ClassName: Test01
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 14:02
+ * @Version 1.0
+ */
+public class Test02 {
+    public static void main(String[] args) {
+
+        HashSet set = new HashSet();
+
+        Person p1 = new Person(1001,"AA"); //34072
+        Person p2 = new Person(1002,"BB"); //34135
+
+        set.add(p1);
+        set.add(p2);
+        p1.name = "CC";
+        set.remove(p1); // 34136  1001 CC
+        System.out.println(set);
+
+        set.add(new Person(1001,"CC")); // 34136
+        System.out.println(set);
+
+        set.add(new Person(1001,"AA")); // 34072
+        System.out.println(set);
+
+        //其中Person类中重写了hashCode()和equal()方法
+
+
+    }
+}

+ 30 - 0
JavaSE/day15/src/com/lc/day15/set07/Test.java

@@ -0,0 +1,30 @@
+package com.lc.day15.set07;
+
+import java.util.LinkedHashSet;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 14:49
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+
+        LinkedHashSet<Integer> linkedHashSet = new LinkedHashSet<>();
+
+        linkedHashSet.add(1);
+        linkedHashSet.add(1);
+        linkedHashSet.add(2);
+        linkedHashSet.add(3);
+
+        for (Integer i : linkedHashSet) {
+            System.out.println(i);
+        }
+
+        System.out.println(linkedHashSet);
+
+    }
+}

+ 32 - 0
JavaSE/day15/src/com/lc/day15/set08/Person.java

@@ -0,0 +1,32 @@
+package com.lc.day15.set08;
+
+/**
+ * ClassName: Person
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 14:56
+ * @Version 1.0
+ */
+public class Person implements Comparable<Person> {
+
+    String name;
+
+    public Person(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public int compareTo(Person o) {
+        // == 0 相等  相等就是同一个对象。
+        // > 0  当前大于传入对象
+        // < 0  当前小于传入对象
+        return this.name.compareTo(o.name);
+    }
+
+    @Override
+    public String toString() {
+        return "Person{" +
+                "name='" + name + '\'' +
+                '}';
+    }
+}

+ 28 - 0
JavaSE/day15/src/com/lc/day15/set08/TestTree.java

@@ -0,0 +1,28 @@
+package com.lc.day15.set08;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * ClassName: TestTree
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 14:54
+ * @Version 1.0
+ */
+public class TestTree {
+
+    public static void main(String[] args) {
+        Set<String> sets = new TreeSet<>();
+
+        sets.add("b");
+        sets.add("a");
+        sets.add("c");
+        sets.add("e");
+        sets.add("h");
+
+        //有序的  自然排序
+        System.out.println(sets);
+    }
+
+}

+ 34 - 0
JavaSE/day15/src/com/lc/day15/set08/TestTree1.java

@@ -0,0 +1,34 @@
+package com.lc.day15.set08;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * ClassName: TestTree
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 14:54
+ * @Version 1.0
+ */
+public class TestTree1 {
+
+    public static void main(String[] args) {
+        Set<Person> sets = new TreeSet<>();
+
+        sets.add(new Person("c"));
+        sets.add(new Person("a"));
+        sets.add(new Person("b"));
+        sets.add(new Person("a"));
+        sets.add(new Person("d"));
+
+        //自然排序 :
+        //1. 元素必须实现Comparable接口
+        //2. 重写compareTo方法
+
+        // Person cannot be cast to class java.lang.Comparable
+
+        System.out.println(sets);
+        // 结果
+
+    }
+}

+ 33 - 0
JavaSE/day15/src/com/lc/day15/set08/TestTree2.java

@@ -0,0 +1,33 @@
+package com.lc.day15.set08;
+
+import java.util.Comparator;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * ClassName: TestTree
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 14:54
+ * @Version 1.0
+ */
+public class TestTree2 {
+
+    public static void main(String[] args) {
+        Set<Person> sets = new TreeSet<>(new Comparator<Person>() {
+            @Override
+            public int compare(Person o1, Person o2) {
+                return -o1.name.compareTo(o2.name);
+            }
+        });
+
+        sets.add(new Person("c"));
+        sets.add(new Person("a"));
+        sets.add(new Person("b"));
+        sets.add(new Person("a"));
+        sets.add(new Person("d"));
+
+        System.out.println(sets);
+
+    }
+}

+ 59 - 0
JavaSE/day15/src/com/lc/day15/set09/Employee.java

@@ -0,0 +1,59 @@
+package com.lc.day15.set09;
+
+/**
+ * ClassName: Employee
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 16:00
+ * @Version 1.0
+ */
+public class Employee implements Comparable<Employee> {
+    private String name;
+    private Integer age;
+    private MyDate birthday;
+
+    public Employee(String name, Integer age, MyDate birthday) {
+        this.name = name;
+        this.age = age;
+        this.birthday = birthday;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getAge() {
+        return age;
+    }
+
+    public void setAge(Integer age) {
+        this.age = age;
+    }
+
+    public MyDate getBirthday() {
+        return birthday;
+    }
+
+    public void setBirthday(MyDate birthday) {
+        this.birthday = birthday;
+    }
+
+    @Override
+    public String toString() {
+        return "Employee{" +
+                "name='" + name + '\'' +
+                ", age=" + age +
+                ", birthday=" + birthday +
+                '}';
+    }
+
+    @Override
+    public int compareTo(Employee o) {
+
+        return this.name.compareTo(o.name);
+    }
+}

+ 54 - 0
JavaSE/day15/src/com/lc/day15/set09/MyDate.java

@@ -0,0 +1,54 @@
+package com.lc.day15.set09;
+
+/**
+ * ClassName: MyDate
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 16:00
+ * @Version 1.0
+ */
+public class MyDate {
+
+    private Integer year;
+    private Integer month;
+    private Integer day;
+
+    public MyDate(Integer year, Integer month, Integer day) {
+        this.year = year;
+        this.month = month;
+        this.day = day;
+    }
+
+    public Integer getYear() {
+        return year;
+    }
+
+    public void setYear(Integer year) {
+        this.year = year;
+    }
+
+    public Integer getMonth() {
+        return month;
+    }
+
+    public void setMonth(Integer month) {
+        this.month = month;
+    }
+
+    public Integer getDay() {
+        return day;
+    }
+
+    public void setDay(Integer day) {
+        this.day = day;
+    }
+
+    @Override
+    public String toString() {
+        return "MyDate{" +
+                "year=" + year +
+                ", month=" + month +
+                ", day=" + day +
+                '}';
+    }
+}

+ 53 - 0
JavaSE/day15/src/com/lc/day15/set09/Test.java

@@ -0,0 +1,53 @@
+package com.lc.day15.set09;
+
+import java.util.Comparator;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 16:00
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+
+        TreeSet<Employee> treeSet = new TreeSet<>();
+        
+        treeSet.add(new Employee("zs",18, new MyDate(1990,3,10) ));
+        treeSet.add(new Employee("lis",18, new MyDate(1994,2,10) ));
+        treeSet.add(new Employee("ww",19, new MyDate(1992,3,22) ));
+        treeSet.add(new Employee("zl",18, new MyDate(1990,4,10) ));
+        treeSet.add(new Employee("kk",22, new MyDate(1993,3,11) ));
+
+        for (Employee employee : treeSet) {
+            System.out.println(employee);
+        }
+
+        //生日日期的
+        TreeSet<Employee> tt = new TreeSet<>(new Comparator<Employee>(){
+
+            @Override
+            public int compare(Employee o1, Employee o2) {
+                //生日月份
+                int i = o1.getBirthday().getMonth().compareTo(o2.getBirthday().getMonth());
+                //天数
+                i = i == 0 ? o1.getBirthday().getDay().compareTo(o2.getBirthday().getDay()): i;
+                return i;
+            }
+        });
+
+
+        tt.addAll(treeSet);
+
+        System.out.println("---------------------");
+        for (Employee employee : tt) {
+            System.out.println(employee);
+        }
+
+    }
+
+}

+ 50 - 0
JavaSE/day15/src/com/lc/day15/set09/Test01.java

@@ -0,0 +1,50 @@
+package com.lc.day15.set09;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.TreeSet;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 16:00
+ * @Version 1.0
+ */
+public class Test01 {
+
+    public static void main(String[] args) {
+        //在一个List集合中存储了多个无大小顺序并且有重复的字符串,
+        // 定义一个方法,让其有序(从小到大排序),并且不能去除重复元素。
+
+        List<Integer> list = new ArrayList<>();
+        list.add(1);
+        list.add(2);
+        list.add(3);
+        list.add(4);
+        list.add(5);
+        list.add(6);
+        list.add(7);
+        list.add(7);
+        list.add(2);
+        list.add(4);
+        list.add(3);
+
+        TreeSet<Integer> set = new TreeSet<>(new Comparator<Integer>() {
+            @Override
+            public int compare(Integer o1, Integer o2) {
+
+                int r = o1.compareTo(o2);
+                return  r == 0 ? 1 : r;
+            }
+        });
+
+        for (Integer i : list) {
+            set.add(i);
+        }
+
+        System.out.println(set);
+
+    }
+}

+ 11 - 0
JavaSE/day16/day16.iml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 60 - 0
JavaSE/day16/src/com/lc/day16/coll06/Test.java

@@ -0,0 +1,60 @@
+package com.lc.day16.coll06;
+
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 11:45
+ * @Version 1.0
+ */
+public class Test {
+    public static void main(String[] args) {
+
+        /*
+        **排序操作:**
+        - reverse(List):反转 List 中元素的顺序
+        - shuffle(List):对 List 集合元素进行随机排序
+        - sort(List):根据元素的自然顺序对指定 List 集合元素按升序排序
+        - sort(List,Comparator):根据指定的 Comparator 产生的顺序对 List 集合元素进行排序
+        - swap(List,int, int):将指定 list 集合中的 i 处元素和 j 处元素进行交换
+         */
+
+        List<Integer> integers = List.of(4, 2, 324, 234, 25, 34, 65, 367);
+
+        ArrayList<Integer> list = new ArrayList<>(integers);
+        //反转
+        Collections.reverse(list);
+
+        System.out.println(list);
+
+        //shuffle 随机调换  洗牌
+        Collections.shuffle(list);
+        System.out.println(list);
+
+        //sort
+        Collections.sort(list);
+        System.out.println(list);
+
+        //Comparator
+        Collections.sort(list, new Comparator<Integer>() {
+            @Override
+            public int compare(Integer o1, Integer o2) {
+                return Integer.compare(o2, o1);
+            }
+        });
+
+        System.out.println(list);
+
+
+        //交换
+        Collections.swap(list, 0, list.size() - 1);
+
+        System.out.println(list);
+    }
+}

+ 45 - 0
JavaSE/day16/src/com/lc/day16/coll06/Test1.java

@@ -0,0 +1,45 @@
+package com.lc.day16.coll06;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 11:45
+ * @Version 1.0
+ */
+public class Test1 {
+    public static void main(String[] args) {
+
+       /*
+       - Object max(Collection):根据元素的自然顺序,返回给定集合中的最大元素
+        - Object max(Collection,Comparator):根据 Comparator 指定的顺序,返回给定集合中的最大元素
+        - Object min(Collection):根据元素的自然顺序,返回给定集合中的最小元素
+        - Object min(Collection,Comparator):根据 Comparator 指定的顺序,返回给定集合中的最小元素
+        - int binarySearch(List list,T key)在List集合中查找某个元素的下标,但是List的元素必须是T或T的子类对象,而且必须是可比较大小的,即支持自然排序的。而且集合也事先必须是有序的,否则结果不确定。
+        - int binarySearch(List list,T key,Comparator c)在List集合中查找某个元素的下标,但是List的元素必须是T或T的子类对象,而且集合也事先必须是按照c比较器规则进行排序过的,否则结果不确定。
+        - int frequency(Collection c,Object o):返回指定集合中指定元素的出现次数
+        */
+
+        List<Integer> integers = List.of(4, 2, 324, 234, 25, 34, 65, 367);
+
+        ArrayList<Integer> list = new ArrayList<>(integers);
+
+        //max
+        Integer max = Collections.max(list);
+        System.out.println(max);
+
+
+        //binarySearch
+        int i = Collections.binarySearch(list, 2); //索引
+        System.out.println(i);
+
+        //frequency
+        int frequency = Collections.frequency(list, 2);
+        System.out.println(frequency);
+    }
+}

+ 46 - 0
JavaSE/day16/src/com/lc/day16/coll06/Test2.java

@@ -0,0 +1,46 @@
+package com.lc.day16.coll06;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 11:45
+ * @Version 1.0
+ */
+public class Test2 {
+    public static void main(String[] args) {
+        /*
+        **复制、替换**
+        - void copy(List dest,List src):将src中的内容复制到dest中
+        - boolean replaceAll(List list,Object oldVal,Object newVal):使用新值替换 List 对象的所有旧值
+        - 提供了多个unmodifiableXxx()方法,该方法返回指定 Xxx的不可修改的视图。
+        **添加**
+        - boolean addAll(Collection  c,T... elements)将所有指定元素添加到指定 collection 中。
+         */
+
+        List<Integer> integers = List.of(4, 2, 324, 234, 25, 34, 65, 367);
+        ArrayList<Integer> list = new ArrayList<>(integers);
+
+        ArrayList<Integer> dest = new ArrayList<>(integers);
+
+        //赋值
+        Collections.copy(dest,list);
+
+        System.out.println(dest);
+
+        // 替换
+        Collections.replaceAll(list,234,2345);
+        System.out.println(list);
+
+
+        //addAll
+        boolean b = Collections.addAll(list, 1111, 2222, 3333, 4444);
+        System.out.println(b);
+
+        System.out.println(list);
+    }
+}

+ 34 - 0
JavaSE/day16/src/com/lc/day16/list07/Person.java

@@ -0,0 +1,34 @@
+package com.lc.day16.list07;
+
+import java.util.Objects;
+
+/**
+ * ClassName: Person
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 16:31
+ * @Version 1.0
+ */
+public class Person {
+
+
+    String name ;
+
+    public Person(String name) {
+        this.name = name;
+    }
+
+
+    @Override
+    public boolean equals(Object object) {
+        if (this == object) return true;
+        if (object == null || getClass() != object.getClass()) return false;
+        Person person = (Person) object;
+        return Objects.equals(name, person.name);
+    }
+
+    @Override
+    public int hashCode() {
+        return 1;
+    }
+}

+ 46 - 0
JavaSE/day16/src/com/lc/day16/list07/Test.java

@@ -0,0 +1,46 @@
+package com.lc.day16.list07;
+
+import java.util.ArrayList;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 13:42
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+
+
+
+        ArrayList<String> list = new ArrayList<>();
+
+        list.add("1"); //1
+        list.add("2");
+        list.add("3");
+        list.add("4");
+        list.add("5");
+        list.add("6");
+        list.add("7");
+        list.add("8");
+        list.add("9"); //9
+        list.add("10"); //10
+        list.add("11"); //11
+        list.add("11"); //11
+        list.add("11"); //11
+        list.add("11"); //11
+        list.add("11"); //11
+        list.add("11"); //11
+        list.add("11"); //11
+        list.add("11"); //11
+
+
+        ArrayList<String> list1 = new ArrayList<>();
+        list1.add("0");
+        list1.addAll(list); //一次性添加 11个元素  看源码
+
+
+    }
+}

+ 22 - 0
JavaSE/day16/src/com/lc/day16/list07/Test1.java

@@ -0,0 +1,22 @@
+package com.lc.day16.list07;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 13:42
+ * @Version 1.0
+ */
+public class Test1 {
+
+    public static void main(String[] args) {
+
+
+        LinkedList<String> list = new LinkedList<>();
+        list.add("1");
+
+    }
+}

+ 23 - 0
JavaSE/day16/src/com/lc/day16/list07/Test2.java

@@ -0,0 +1,23 @@
+package com.lc.day16.list07;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 13:42
+ * @Version 1.0
+ */
+public class Test2 {
+
+    public static void main(String[] args) {
+
+        HashMap<Integer,Integer> map = new HashMap<>();
+
+        map.put(1,111);
+        map.put(2,111);
+
+    }
+}

+ 23 - 0
JavaSE/day16/src/com/lc/day16/list07/Test4.java

@@ -0,0 +1,23 @@
+package com.lc.day16.list07;
+
+import java.util.HashMap;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 13:42
+ * @Version 1.0
+ */
+public class Test4 {
+
+    public static void main(String[] args) {
+
+        HashMap<Person,Integer> map = new HashMap<>();
+
+        map.put(new Person("1"),0);
+        map.put(new Person("2"),0);
+
+
+    }
+}

+ 24 - 0
JavaSE/day16/src/com/lc/day16/map01/Person.java

@@ -0,0 +1,24 @@
+package com.lc.day16.map01;
+
+/**
+ * ClassName: Person
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 9:51
+ * @Version 1.0
+ */
+public class Person {
+
+    String name;
+
+    public Person(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String toString() {
+        return "Person{" +
+                "name='" + name + '\'' +
+                '}';
+    }
+}

+ 144 - 0
JavaSE/day16/src/com/lc/day16/map01/TestMap01.java

@@ -0,0 +1,144 @@
+package com.lc.day16.map01;
+
+import jdk.swing.interop.SwingInterOpUtils;
+
+import java.util.*;
+
+/**
+ * ClassName: TestMap01
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 9:42
+ * @Version 1.0
+ */
+public class TestMap01 {
+    public static void main(String[] args) {
+
+        /*
+        - **添加、修改操作:**
+          - Object put(Object key,Object value):将指定key-value添加到(或修改)当前map对象中
+          - void putAll(Map m):将m中的所有key-value对存放到当前map中
+        - **删除操作:**
+          - Object remove(Object key):移除指定key的key-value对,并返回value
+          - void clear():清空当前map中的所有数据
+        - **元素查询的操作:**
+          - Object get(Object key):获取指定key对应的value
+          - boolean containsKey(Object key):是否包含指定的key
+          - boolean containsValue(Object value):是否包含指定的value
+          - int size():返回map中key-value对的个数
+          - boolean isEmpty():判断当前map是否为空
+          - boolean equals(Object obj):判断当前map和参数对象obj是否相等
+        - **元视图操作的方法:**
+          - Set keySet():返回所有key构成的Set集合
+          - Collection values():返回所有value构成的Collection集合
+          - Set entrySet():返回所有key-value对构成的Set集合
+         */
+
+        //map
+        Map<Object,String> map = new HashMap<>();
+
+        map.put(1,"kunkun");
+        map.put(2,"ff");
+        map.put(3,"ff");
+        map.put(3,"llei"); //key 重复 替换 value 覆盖
+        map.put(4,null);
+        map.put(null,null);
+
+        System.out.println(map);
+
+
+        //putAll
+
+
+        Map<Object,String> map1 = new HashMap<>();
+        map1.put(1,"zs");
+        map1.put(2,"hmm");
+        Map<Object,String> map2 = new HashMap<>(map1);
+        map2.put(3,"zl");
+        map2.put(4,"zl");
+
+        //map1.putAll(map2);
+        // System.out.println(map1);
+        System.out.println(map2);
+
+        String remove = map2.remove(1);
+        System.out.println(remove);
+
+        //System.out.println(map2);
+        //map2.clear();
+        System.out.println(map2);
+
+        //get
+        String s = map2.get(2);
+        System.out.println(s);
+        System.out.println(map2);
+
+        boolean b = map2.containsKey(7);
+        System.out.println(b);
+        //containsValue
+        boolean b1 = map2.containsValue("zl");
+        System.out.println(b1);
+
+        //size
+        int size = map2.size();
+        System.out.println(size);
+
+        //empty
+        boolean empty = map2.isEmpty();
+        System.out.println(empty);
+
+
+        Map<Integer,Person> map3 = new HashMap<>();
+
+        map3.put(1,new Person("韩梅梅"));
+        map3.put(2,new Person("李雷"));
+        map3.put(3,new Person("小明"));
+        map3.put(4,new Person("小红"));
+
+        //根据key获取value
+
+        //keySet
+        for (Integer i : map3.keySet()) {
+            Person person = map3.get(i);
+
+            System.out.println("key:"+i + "---value:"+ person);
+        }
+
+
+        //entrySet
+        for (Map.Entry<Integer, Person> entry : map3.entrySet()) {
+            System.out.println(entry.getKey() +"---"+ entry.getValue());
+        }
+
+
+        //班级名称   班级 多个人 List
+
+        Map<String, List<Person>> classs = new HashMap<>();
+
+        List<Person> list = new ArrayList<>();
+        list.add(new Person("hmm1"));
+        list.add(new Person("hmm2"));
+        list.add(new Person("hmm3"));
+        list.add(new Person("hmm4"));
+
+        classs.put("java",list);
+
+        List<Person> java = classs.get("java");
+
+        for (Person person : java) {
+            System.out.println(person);
+        }
+
+
+        //key
+        Map<Person,String> map4 = new HashMap<>();
+        map4.put(new Person("1"),"1");
+        map4.put(new Person("1"),"1");
+        map4.put(new Person("1"),"1");
+        map4.put(new Person("1"),"1");
+
+        System.out.println(map4.size()); // 没有重写 存的是 地址。
+
+    }
+
+}

+ 38 - 0
JavaSE/day16/src/com/lc/day16/map02/Test.java

@@ -0,0 +1,38 @@
+package com.lc.day16.map02;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 10:53
+ * @Version 1.0
+ */
+public class Test {
+
+
+    public static void main(String[] args) {
+
+        LinkedHashMap<Integer, String> linkedHashMap = new LinkedHashMap<>();
+
+        linkedHashMap.put(1,"a");
+        linkedHashMap.put(2,"b");
+        linkedHashMap.put(3,"c");
+        linkedHashMap.put(4,"d");
+
+        String s = linkedHashMap.get(1);
+        System.out.println(s);
+
+
+        Set<Map.Entry<Integer, String>> entries = linkedHashMap.entrySet();
+
+        for (Map.Entry<Integer, String> entry : entries) {
+            System.out.println(entry.getKey() +"-"+ entry.getValue());
+        }
+
+        
+    }
+}

+ 45 - 0
JavaSE/day16/src/com/lc/day16/map03/Test.java

@@ -0,0 +1,45 @@
+package com.lc.day16.map03;
+
+import java.util.Comparator;
+import java.util.Set;
+import java.util.TreeMap;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 10:57
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+
+        TreeMap<Integer,String> treeMap = new TreeMap<>();
+
+        treeMap.put(3, "3");
+        treeMap.put(4, "3");
+        treeMap.put(1, "3");
+        treeMap.put(2, "3");
+
+        //Integer 实现 cmoparable 接口
+
+        Set<Integer> integers = treeMap.keySet();
+        System.out.println(integers);
+
+
+        TreeMap<Integer,String> treeMap1 = new TreeMap<>(new Comparator<Integer>() {
+            @Override
+            public int compare(Integer o1, Integer o2) {
+
+                return -Integer.compare(o1,o2);
+            }
+        });
+        treeMap1.putAll(treeMap);
+
+        System.out.println(treeMap1.keySet());
+
+    }
+
+
+}

+ 38 - 0
JavaSE/day16/src/com/lc/day16/map04/Test.java

@@ -0,0 +1,38 @@
+package com.lc.day16.map04;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 11:13
+ * @Version 1.0
+ */
+public class Test {
+    public static void main(String[] args) {
+
+        Hashtable<Integer,String> hashtable = new Hashtable<>();
+        //该类实现了一个哈希表,它将键映射到值。 任何非null对象都可以用作键或值。
+
+        hashtable.put(1,"a");
+        hashtable.put(2,"b");
+
+        Enumeration<String> elements = hashtable.elements();
+
+        while (elements.hasMoreElements()){
+            System.out.println(elements.nextElement());
+        }
+
+        //和其他对比
+        //线程安全的
+
+
+        Hashtable hash  = new Hashtable();
+
+        hash.put(null,null);
+
+        System.out.println(hash);
+    }
+}

+ 40 - 0
JavaSE/day16/src/com/lc/day16/map05/Test.java

@@ -0,0 +1,40 @@
+package com.lc.day16.map05;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 11:21
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+
+
+        Properties properties = new Properties();
+
+        properties.put("name", "jack");
+        properties.put("pass", "123456");
+
+
+        String property = properties.getProperty("name");
+        System.out.println(property);
+
+        //properties.load(); //文件
+
+        Set<Object> objects = properties.keySet();
+
+        System.out.println(objects);
+
+
+        HashSet set = new HashSet();
+
+        set.add("123");
+    }
+}

+ 11 - 0
JavaSE/day17/day17.iml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 80 - 0
JavaSE/day17/src/com/lc/day16/homework/Test01.java

@@ -0,0 +1,80 @@
+package com.lc.day16.homework;
+
+import java.util.*;
+
+/**
+ * ClassName: Test01
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 9:12
+ * @Version 1.0
+ */
+public class Test01 {
+    /*
+    1. 生成牌:生成54张扑克牌。使用LinkedHashMap,完成一个数字与字符串纸牌的对应关系
+    2. 洗牌:对54张牌进行随机排序。
+    3. 发牌:三个玩家参与游戏并交替摸牌,最后三张留作底牌。使用ArrayList存储各个玩家及底牌的牌。
+    4. 看牌:查看三人各自手中的牌(按照牌的大小排序)、底牌
+     */
+    public static void main(String[] args) {
+        //存储数字
+        String[] nums = { "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A", "2" };
+        //存储花色
+        String[] colors = { "♦", "♣", "♥", "♠" };
+        //存储牌
+        LinkedHashMap<Integer, String> cards = new LinkedHashMap<>();
+        //索引
+        int index = 0;
+        //ArrayList
+        List<Integer> list = new ArrayList<>();
+
+        for (String num : nums) {
+            for (String color : colors) {
+                cards.put(index, color + num);
+                list.add(index);
+                index++;
+            }
+        }
+        //大王  小王
+        cards.put(index, "小王");
+        list.add(index);
+        list.add(++index);
+        cards.put(index, "大王");
+        //洗牌
+        Collections.shuffle(list);
+        //玩家
+        TreeMap<Integer, String> paly1 = new TreeMap<>();
+        TreeMap<Integer, String> paly2 = new TreeMap<>();
+        TreeMap<Integer, String> paly3 = new TreeMap<>();
+
+        List<String> dipai = new ArrayList<>();
+        dipai.add( cards.get(list.get(0)) );
+        dipai.add( cards.get(list.get(1)));
+        dipai.add( cards.get(list.get(2)));
+
+        //发牌
+        for (int i = 3; i < list.size(); i++) {
+            if(i % 3 == 0){
+                paly1.put(list.get(i),cards.get(list.get(i)));
+            }else if(i % 3 == 1){
+                paly2.put(list.get(i),cards.get(list.get(i)));
+            }else if (i % 3 == 2){
+                paly3.put(list.get(i),cards.get(list.get(i)));
+            }
+        }
+
+        //看牌
+        lookPoker("玩家1",paly1);
+        lookPoker("玩家2",paly2);
+        lookPoker("玩家3",paly3);
+        //底牌
+        System.out.println("底牌:" + dipai);
+
+    }
+
+    private static void lookPoker(String 玩家1, TreeMap<Integer, String> paly1) {
+        System.out.println(玩家1 + ":" + paly1.values());
+    }
+
+
+}

+ 62 - 0
JavaSE/day17/src/com/lc/day16/homework/Test02.java

@@ -0,0 +1,62 @@
+package com.lc.day16.homework;
+
+import java.util.*;
+
+/**
+ * ClassName: Test01
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 9:12
+ * @Version 1.0
+ */
+public class Test02 {
+    /*
+        把字符串str字符串先按照;进行拆分,得到34个省(包括23个省,5个自治区,4个直辖市,2个特别行政区,下面的题目描述中,把它们都成为省份)
+        然后把每个省的字符串,按照:进行拆分,那么:左边的是省份名称,:右边的是该省的各市辖区
+        把34个省存储到一个HashMap集合中,其中编号是key,省份名是value
+        把所有省份的城市存储到一个LinkedHashMap集合中,其中省份名是key,该省份的所有城市用一个ArrayList的集合装起来,然后作为value。
+     */
+    public static void main(String[] args) {
+        //河北、山西、辽宁、吉林、黑龙江、江苏、浙江、安徽、福建、江西、山东、河南、湖北、湖南、广东、海南、四川、贵州、云南、陕西、甘肃、青海、台湾
+        String str = "河北、山西、辽宁、吉林、黑龙江、江苏、浙江、安徽、福建、江西、山东、河南、湖北、湖南、广东、海南、四川、贵州、云南、陕西、甘肃、青海、台湾";
+
+        String[] arr = str.split("、");
+        
+        HashMap<Integer,String> map = new HashMap<>();
+
+        for (int i = 0; i < arr.length; i++) {
+            map.put(i+1,arr[i]);
+        }
+
+        //城市
+        List ln = List.of("丹东","大连","抚顺","本溪","营口","阜新","辽阳","盘锦","铁岭","朝阳","葫芦岛");
+        List hlj = List.of("哈尔滨","齐齐哈尔","牡丹江","佳木斯","大庆","鸡西","双鸭山","鹤岗","七台河","黑河");
+        List jl = List.of("长春","吉林","延边朝鲜族自治州","四平","通化","白山","白城","辽源");
+
+        //
+        LinkedHashMap<String,List> cityMap = new LinkedHashMap<>();
+        cityMap.put(map.get(2),ln);
+        cityMap.put(map.get(3),hlj);
+        cityMap.put(map.get(4),jl);
+
+
+        //输入
+        Scanner scanner = new Scanner(System.in);
+        System.out.println("请选择:");
+        for (Map.Entry<Integer, String> s : map.entrySet()) {
+            System.out.println(s.getKey() + ":" + s.getValue());
+        }
+        //输入索引
+        int index = scanner.nextInt();
+        //value 获取 城市
+        String s = map.get(index);
+        List list = cityMap.get(s);
+
+        //输出
+        System.out.println(list);
+
+    }
+
+
+
+}

+ 18 - 0
JavaSE/day17/src/com/lc/homework/day17/thread/Test01.java

@@ -0,0 +1,18 @@
+package com.lc.homework.day17.thread;
+
+/**
+ * ClassName: Test01
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 10:37
+ * @Version 1.0
+ */
+public class Test01 {
+
+    public static void main(String[] args) {
+        //主线程
+        System.out.println(Thread.currentThread().getName());
+
+        System.out.println();
+    }
+}

+ 18 - 0
JavaSE/day17/src/com/lc/homework/day17/thread1/MyThread.java

@@ -0,0 +1,18 @@
+package com.lc.homework.day17.thread1;
+
+/**
+ * ClassName: MyThread
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 10:56
+ * @Version 1.0
+ */
+public class MyThread  extends  Thread{
+
+    @Override
+    public void run() {
+        for (int i = 0; i < 100; i++) {
+            System.out.println("mythread1");
+        }
+    }
+}

+ 18 - 0
JavaSE/day17/src/com/lc/homework/day17/thread1/MyThread2.java

@@ -0,0 +1,18 @@
+package com.lc.homework.day17.thread1;
+
+/**
+ * ClassName: MyThread2
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 11:04
+ * @Version 1.0
+ */
+public class MyThread2 implements  Runnable{
+
+    @Override
+    public void run() {
+        for (int i = 0; i < 100; i++) {
+            System.out.println("mythread2");
+        }
+    }
+}

+ 32 - 0
JavaSE/day17/src/com/lc/homework/day17/thread1/Test.java

@@ -0,0 +1,32 @@
+package com.lc.homework.day17.thread1;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 10:57
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+
+        // 继承 Thread启动
+        MyThread myThread = new MyThread();
+        myThread.start(); // 主  my子线程  抢占资源。
+        //cpu 抢占
+
+        // 实现Runable
+        MyThread2 myThread2 = new MyThread2();
+        //new Thread
+        Thread thread = new Thread(myThread2);
+        //启动
+        thread.start();
+
+        //主线程 运行100次。
+        for (int i = 0; i < 100 ; i++) {
+            System.out.println("主线程");
+        }
+
+    }
+}

+ 30 - 0
JavaSE/day17/src/com/lc/homework/day17/thread2/Test.java

@@ -0,0 +1,30 @@
+package com.lc.homework.day17.thread2;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 11:41
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+
+        new Thread() {
+            @Override
+            public void run() {
+                System.out.println("匿名 继承 thread");
+            }
+        }.start();
+
+        new Thread(
+            new Runnable() {
+                @Override
+                public void run() {
+                    System.out.println("匿名 实现 runnable");
+                }
+            }
+        ).start();
+    }
+}

+ 36 - 0
JavaSE/day17/src/com/lc/homework/day17/thread3/Test.java

@@ -0,0 +1,36 @@
+package com.lc.homework.day17.thread3;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 11:48
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+
+        /*
+        - public Thread() :分配一个新的线程对象。
+        - public Thread(String name) :分配一个指定名字的新的线程对象。
+        - public Thread(Runnable target) :指定创建线程的目标对象,它实现了Runnable接口中的run方法
+        - public Thread(Runnable target,String name) :分配一个带有指定目标新的线程对象并指定名字。
+
+
+         */
+        Thread thread = new Thread("子线程1");
+        System.out.println(thread.getName());
+
+        //参数1 runable 参数2 名称
+        Thread thread1 = new Thread(new Runnable() {
+            @Override
+            public void run() {
+
+            }
+        }, "子线程2");
+        System.out.println(thread1.getName());
+
+    }
+
+}

+ 99 - 0
JavaSE/day17/src/com/lc/homework/day17/thread3/Test2.java

@@ -0,0 +1,99 @@
+package com.lc.homework.day17.thread3;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 11:48
+ * @Version 1.0
+ */
+public class Test2 {
+
+    public static void main(String[] args) throws InterruptedException {
+
+        /*
+        * public void run() :此线程要执行的任务在此处定义代码。
+        * public void start() :导致此线程开始执行; Java虚拟机调用此线程的run方法。
+        * public String getName() :获取当前线程名称。
+        * public void setName(String name):设置该线程名称。
+        * public static Thread currentThread() :返回对当前正在执行的线程对象的引用。在Thread子类中就是this,通常用于主线程和Runnable实现类
+        * public static void sleep(long millis) :使当前正在执行的线程以指定的毫秒数暂停(暂时停止执行)。
+        * public final boolean isAlive():测试线程是否处于活动状态。如果线程已经启动且尚未终止,则为活动状态。
+        * void join() :等待该线程终止。 插队
+          void join(long millis) :等待该线程终止的时间最长为 millis 毫秒。如果millis时间到,将不再等待。
+          void join(long millis, int nanos) :等待该线程终止的时间最长为 millis 毫秒 + nanos 纳秒。
+
+         */
+
+        Thread thread = new Thread(){
+            @Override
+            public void run() {
+                try {
+                    Thread.sleep(5000);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+                System.out.println(Thread.currentThread().getName());
+            }
+        };
+        thread.setName("线程1");
+
+//        thread.start();
+
+        Thread thread1 = new Thread() {
+            @Override
+            public void run() {
+
+            }
+        };
+
+//        thread1.start();
+
+        thread1.join();
+        boolean alive = thread1.isAlive();
+        System.out.println(alive);
+
+
+        //主线程
+        Thread thread2 = new Thread() {
+            @Override
+            public void run() {
+                for (int i = 0; i < 10000; i++) {
+                    System.out.println("thread2");
+                }
+
+            }
+        };
+        Thread thread3 = new Thread() {
+            @Override
+            public void run() {
+                try {
+                    thread2.join(1,1);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+                System.out.println("thread3");
+            }
+        };
+        Thread thread4 = new Thread() {
+            @Override
+            public void run() {
+                try {
+                    thread3.join();
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+                System.out.println("thread4");
+            }
+        };
+
+        //控制 t1 ,t2 ,t3 线程的执行顺序
+
+        thread2.start();
+        thread3.start();
+        thread4.start();
+
+
+    }
+
+}

+ 56 - 0
JavaSE/day17/src/com/lc/homework/day17/thread4/Test.java

@@ -0,0 +1,56 @@
+package com.lc.homework.day17.thread4;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 13:37
+ * @Version 1.0
+ */
+public class Test {
+    public static void main(String[] args) throws InterruptedException {
+        /*
+        - 声明一个匿名内部类继承Thread类,重写run方法,实现打印[1,100]之间的偶数,要求每隔1秒打印1个偶数。
+        - 声明一个匿名内部类继承Thread类,重写run方法,实现打印[1,100]之间的奇数,
+          - 当打印到5时,让奇数线程停下来,让偶数线程执行完再打印。
+         */
+        Thread thread1 = new Thread() {
+            @Override
+            public void run() {
+                for (int i = 0; i < 100; i += 2) {
+                    try {
+                        Thread.sleep(10);
+                    } catch (InterruptedException e) {
+                        throw new RuntimeException(e);
+                    }
+                    System.out.println(i);
+                }
+            }
+        };
+
+        Thread thread2 = new Thread() {
+            @Override
+            public void run() {
+                for (int i = 1; i < 100; i += 2) {
+                    if (i == 5){
+                        try {
+                            thread1.join();
+                        } catch (InterruptedException e) {
+                            throw new RuntimeException(e);
+                        }
+                    }
+                    System.out.println("奇数:"+i);
+                }
+            }
+        };
+
+        thread1.start();
+        thread2.start();
+
+        thread1.join();
+        thread2.join();
+
+        System.out.println("执行完成");
+
+    }
+}

+ 79 - 0
JavaSE/day17/src/com/lc/homework/day17/thread5/Test.java

@@ -0,0 +1,79 @@
+package com.lc.homework.day17.thread5;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 13:57
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) throws InterruptedException {
+        List<Integer> list = new ArrayList<>();
+
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                for (int i = 1; i <= 10; i++) {
+                    try {
+                        Thread.sleep(1);
+                    } catch (InterruptedException e) {
+                        throw new RuntimeException(e);
+                    }
+                    list.add(i);
+                }
+            }
+        };
+        
+        Thread thread1 = new Thread() {
+            @Override
+            public void run() {
+
+                for (int i = 11; i <= 20; i++) {
+                    try {
+                        Thread.sleep(1);
+                    } catch (InterruptedException e) {
+                        throw new RuntimeException(e);
+                    }
+                    list.add(i);
+                }
+
+            }
+        };
+
+        Thread thread2 = new Thread() {
+            @Override
+            public void run() {
+
+                for (int i = 21; i <= 30; i++) {
+                    try {
+                        Thread.sleep(1);
+                    } catch (InterruptedException e) {
+                        throw new RuntimeException(e);
+                    }
+                    list.add(i);
+                }
+
+            }
+        };
+
+        thread.start();
+        thread1.start();
+        thread2.start();
+
+        thread.join();
+        thread1.join();
+        thread2.join();
+
+        //排序
+        Collections.sort(list);
+
+        System.out.println(list);
+
+    }
+}

+ 52 - 0
JavaSE/day17/src/com/lc/homework/day17/thread5/Test1.java

@@ -0,0 +1,52 @@
+package com.lc.homework.day17.thread5;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 13:57
+ * @Version 1.0
+ */
+public class Test1 {
+
+    public static void main(String[] args) throws InterruptedException {
+
+
+        //线程1 执行   hello java
+        new Thread(){
+            @Override
+            public void run() {
+                for (int i = 0; i < 100; i++) {
+                    hello1();
+                }
+            }
+        }.start();
+        //线程2 执行   哈喽  爪洼
+        new Thread(){
+            @Override
+            public void run() {
+                for (int i = 0; i < 100; i++) {
+                    hello2();
+                }
+            }
+        }.start();
+
+        //synchronized 保证 代码 在整个方法中 或者十整个 代码块 不被其他线程打断。
+    }
+
+    public static synchronized void hello1() {
+
+        System.out.print("hello ");
+        System.out.println("java");
+    }
+
+    public static synchronized void hello2() {
+        System.out.print("哈喽 ");
+        //被打断了  不应该被打断。
+        System.out.println("爪洼 ");
+    }
+}

+ 52 - 0
JavaSE/day17/src/com/lc/homework/day17/thread6/Test.java

@@ -0,0 +1,52 @@
+package com.lc.homework.day17.thread6;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 15:19
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+        Tikcet tikcet1 = new Tikcet(); // new 100
+        Tikcet tikcet2 = new Tikcet(); // new 100  不属于同一个资源。
+        new Thread("窗口1"){
+            @Override
+            public void run() {
+                for (int i = 0; i < 100 ; i++) {
+                    tikcet1.sale();
+                }
+            }
+        }.start();
+
+        new Thread("窗口2"){
+            @Override
+            public void run() {
+                for (int i = 0; i < 100 ; i++) {
+                    tikcet1.sale();
+                }
+            }
+        }.start();
+
+        new Thread("窗口3"){
+            @Override
+            public void run() {
+                for (int i = 0; i < 100 ; i++) {
+                    tikcet1.sale();
+                }
+            }
+        }.start();
+
+        new Thread("窗口4"){
+            @Override
+            public void run() {
+                for (int i = 0; i < 100 ; i++) {
+                    tikcet1.sale();
+                }
+            }
+        }.start();
+
+    }
+}

+ 91 - 0
JavaSE/day17/src/com/lc/homework/day17/thread6/Tikcet.java

@@ -0,0 +1,91 @@
+package com.lc.homework.day17.thread6;
+
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * ClassName: Tikcet
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 15:17
+ * @Version 1.0
+ */
+public class Tikcet {
+
+    private static int ticket = 100;
+    Lock  lock = new ReentrantLock();
+
+    public void sale(){
+
+        lock.lock();
+        if ( ticket > 0  ){
+
+            try {
+                Thread.sleep(10);
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            }
+            System.out.println(Thread.currentThread().getName() + "卖 第"+ticket+"张票");
+
+            ticket--;
+        }
+        lock.unlock();
+
+    }
+
+
+    public void sale4(){
+        //代码块 参数 锁对象
+        //synchronized (this){
+        synchronized (Tikcet.class){
+            if ( ticket > 0  ){
+                try {
+                    Thread.sleep(10);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+                System.out.println(Thread.currentThread().getName() + "卖 第"+ticket+"张票");
+
+                ticket--;
+            }
+        }
+    }
+
+    /*
+    卖票
+     */
+    //  线程1 线程2 线程3 线程4  获取锁
+    public static  synchronized void sale2(){
+        //System.out.println(this);
+        System.out.println(Tikcet.class);
+        if ( ticket > 0  ){
+            try {
+                Thread.sleep(10);
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            }
+            System.out.println(Thread.currentThread().getName() + "卖 第"+ticket+"张票");
+
+            ticket--;
+        }
+    }
+
+    public  synchronized void sale1(){
+        System.out.println(this);
+        if ( ticket > 0  ){
+            try {
+                Thread.sleep(10);
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            }
+            System.out.println(Thread.currentThread().getName() + "卖 第"+ticket+"张票");
+
+            ticket--;
+        }
+    }
+
+    public int getTicket() {
+        return ticket;
+    }
+
+}

+ 55 - 0
JavaSE/day17/src/com/lc/homework/day17/thread7/Test.java

@@ -0,0 +1,55 @@
+package com.lc.homework.day17.thread7;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/15 16:41
+ * @Version 1.0
+ */
+public class Test {
+    public static void main(String[] args) {
+        String s1 = new String("s1");
+        String s2 = new String("s2");
+
+        new Thread(){
+            @Override
+            public void run() {
+                while (true){
+                    synchronized (s1){
+                        System.out.println("Thread1 get s1 lock");
+                        try {
+                            Thread.sleep(100);
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        }
+                        synchronized (s2){
+                            System.out.println("Thread1 get s2 lock");
+                        }
+                    }
+                }
+            }
+        }.start();
+
+        new Thread(){
+            @Override
+            public void run() {
+                while (true){
+                    synchronized (s2){
+                        System.out.println("Thread1 get s2 lock");
+                        try {
+                            Thread.sleep(100);
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();
+                        }
+                        synchronized (s1){
+                            System.out.println("Thread1 get s1 lock");
+                        }
+                    }
+                }
+            }
+        }.start();
+
+
+    }
+}

+ 11 - 0
JavaSE/day_test/day_test.iml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 65 - 0
JavaSE/day_test/src/com/lc/day/MyClassLoaderTest.java

@@ -0,0 +1,65 @@
+package com.lc.day;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.Date;
+
+/**
+ * ClassName: MyClassLoaderTest
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/11 12:36
+ * @Version 1.0
+ */
+public class MyClassLoaderTest {
+
+    static class MyClassLoader extends ClassLoader {
+        private String classPath;
+
+        public MyClassLoader(String classPath) {
+            this.classPath = classPath;
+        }
+
+        private byte[] loadByte(String name) throws IOException {
+            name = name.replace("\\.","/");
+            FileInputStream fis = new FileInputStream(classPath + "/" + name + ".class");
+
+            int available = fis.available();
+
+            byte[] data = new byte[available];
+
+            fis.read(data);
+
+            fis.close();
+
+            return data;
+        }
+
+        protected Class<?> findClass(String name) throws ClassNotFoundException {
+            try {
+                byte[] data = loadByte(name);
+                // defineClass将一个字节数组转为Class对象,这个字节数组是class文件读取后最终的字节数组。
+                return defineClass(name, data, 0, data.length);
+            } catch (IOException e) {
+                e.printStackTrace();
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        //初始化自定义类加载器,会先初始化父类ClassLoader,其中会把自定义类加载器的父加载器设置为应用程序类加载器AppClassLoader
+        MyClassLoader myClassLoader = new MyClassLoader("D:/test");
+        //D盘创建test/com/tuling/jvm 几级目录,将User类的复制类User1.class丢入该目录
+        Class clazz=myClassLoader.loadClass("com.xxeg.jvm.User1");
+        Object obj=clazz.newInstance();
+
+        Method method = clazz.getDeclaredMethod("sout", null);
+
+        method.invoke(obj, null);
+
+        System.out.println(clazz.getClassLoader().getClass().getName());
+    }
+}

+ 17 - 0
JavaSE/day_test/src/com/lc/day/Test.java

@@ -0,0 +1,17 @@
+package com.lc.day;
+
+/**
+ * ClassName: Test
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/12 10:19
+ * @Version 1.0
+ */
+public class Test {
+
+    public static void main(String[] args) {
+        while (true){
+            new Object();
+        }
+    }
+}

+ 36 - 0
JavaSE/day_test/src/com/lc/day/TestDynamicLoad.java

@@ -0,0 +1,36 @@
+package com.lc.day;
+
+/**
+ * ClassName: TestDynamicLoad
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/10 17:28
+ * @Version 1.0
+ */
+public class TestDynamicLoad {
+    static {
+        System.out.println("*************load TestDynamicLoad************");
+    }
+
+    public static void main(String[] args) {
+        new A();
+        System.out.println("*************load test************");
+        B b=null;//B不会加载,除非这里执行 new B()
+    }
+}
+class A {
+    static {
+        System.out.println("*************load A************");
+    }
+    public A() {
+        System.out.println("*************initial A************");
+    }
+}
+class B {
+    static {
+        System.out.println("*************load B************");
+    }
+    public B() {
+        System.out.println("*************initial B************");
+    }
+}

+ 15 - 0
JavaSE/day_test/src/com/lc/day/TestJDKClassLoader.java

@@ -0,0 +1,15 @@
+package com.lc.day;
+
+/**
+ * ClassName: TestJDKClassLoader
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2024/1/10 17:37
+ * @Version 1.0
+ */
+public class TestJDKClassLoader {
+    public static void main(String[] args) {
+        System.out.println(String.class.getClassLoader());
+        //System.out.println(com.sun.crypto.provider.DESKeyFactory.class.getClassLoader().getClass().getName());
+    }
+}