当前位置: 首页 > news >正文

集合深入------理解底层。

集合的使用

前提:栈、堆、二叉树、hashcode、toString()、quesalus()的知识深入和底层理解。

1、什么是集合

集合就是咋们所说的容器
​
前面我们学习过数组  数组也是容器
​
容器:装东西的  生活中有多少的容器呀?  水杯  教室  酒瓶  水库  只要是能装东西的 都可以看成是容器
​
我们这个集合的容器 是用来装啥的呢?  装数据?
​
数据? 一切可以被计算机识别的 文字  图片  视频  音频都是数据
​
说白了 我们今天所学习的这个集合 就跟前面的数组类似  只是底层的实现不一样而已

2、集合的分类

主要根据我们的值的个数 可以分成 单例集合 和  双列集合
​
单例集合:简单的说 在这个容器中存放的的值 就是一个一个的  value单列集合的爹:Collection
​
双列集合:他在容器中存储的数据就是  键值对  key---value双列集合的爹:Map

3、单列集合

3.1、List集合
3.1.1、ArrayList
ArrayList<E>   这个集合中的泛型:表示的意思其实就是对这个容器中能存放数据类型的一种约束  比如我们的泛型的数据类型是:User  那么这个容器中只能存放User类型的数据
​
这个ArrayList底层就是数组 他是有序的  地址空间是连续的  地址空间连续 就意味着能通过开始地址+偏移量来为访问 而且能重复添加数据
​
有序:一定能通过下标访问数据
​
List中所有的内容都是可以重复的....
3.1.1.1、集合的使用
public class ArrayListTest {
​public static void main(String[] args) {//第一种方式List<String> list = new ArrayList<>();//接下来就可以向这个集合中存放数据了...list.add("123");list.add("456");list.add("789");list.add("789");
​List<String> list2 = new ArrayList<>();//接下来就可以向这个集合中存放数据了...list.add("12322");list.add("45622");
​
​//将list2集合中的数据 添加到 list中来list.addAll(list2);
​
​//能不能删除数据呢?//这个就是直接删除某一个元素list.remove("789");
​//还可以通过下标删除list.remove(0);
​
​//接下来玩下修改呢?list.set(0,"小波波");
​//获取某一个位置的元素String s = list.get(0);
​//判断这个集合中是否存在某一个元素boolean contains = list.contains("789");
​//判断集合是否为空boolean empty = list.isEmpty();
​//返货某一个元素的下标位置int i = list.indexOf("789");
​//截取集合中指定位置的元素 生成一个新的集合List<String> stringList = list.subList(0, 5);
​System.out.println("list集合的size:"+list.size());
​List<User> userList=new ArrayList<>();userList.add(new User(1,"小小","123"));userList.add(0,new User(0,"这里是测试","xxx"));
​System.out.println("userList集合的size:"+userList.size());System.out.println("userList中的数据是:"+userList.get(0));}
}
public class ArrayListTest1 {
​public static void main(String[] args) {List<String> list = new ArrayList<>();//接下来就可以向这个集合中存放数据了...list.add("123");list.add("456");list.add("789");list.add("789");
​//第一种遍历方式:因为这个ArrayList本身底层是数组(Object类型的数组) 数组地址空间连续 所以我们能通过下标来访问for (int i = 0; i <list.size() ; i++) {System.out.println("集合中的值:"+list.get(i));}System.out.println("------------------------------");
​
​//第二种遍历方式 通过增强的for循环来玩for (String val:list){System.out.println("集合中的值:"+val);}
​
​System.out.println("------------------------------");
​
​//第三种遍历方式通过JDK8中的stream流来遍历list.stream().forEach(val->{System.out.println("集合中的值:"+val);});
​System.out.println("------------------------------");
​//第四种遍历方式:迭代器  迭代器的游标问题/*** 这种情况下不允许对元素进行修改和删除** 其实不止是这种情况 在遍历的情况下 逻辑上都允许修改和删除的产生*/Iterator<String> it = list.iterator();// it.hasNext():判断下一个节点是否有元素while (it.hasNext()){//  it.next() :取出当前位置的元素String val = it.next();System.out.println("通过迭代器取出来的值:"+val);}
​System.out.println("------------------------------");
​//第五种遍历方式ListIterator<String> it1 = list.listIterator();while (it1.hasNext()){String next = it1.next();System.out.println("通过迭代器取出来的值:"+next);}}
}
3.1.2、LinkedList
LinkedList底层是链表 
​
链表中包含 一个一个的链条   每一个链条都包含了两部分
​
当前节点的值  和 下一个元素的地址
​
链表中 数据存储的地址空间不连续  所以不能使用偏移量来访问

输出的值是连续的。

public class LinkedListTest01 {
​public static void main(String[] args) {//申明对象List<String> linkedList1 = new LinkedList<>();linkedList1.add("001");linkedList1.add("002");linkedList1.add("003");linkedList1.add("004");
​for (int i = 0; i < linkedList1.size(); i++) {String val = linkedList1.get(i);System.out.println("val:"+val);}for (String val:linkedList1){System.out.println("val:"+val);}
​linkedList1.stream().forEach(val->{System.out.println("val:"+val);});}
}
​
3.1.3、Vector的使用(不常用)
这个底层也是数组  线程安全的  效率不高
​
这个集合基本不使用 不也用记住
public class VectorTest {public static void main(String[] args){List<String> vector=new Vector<>();vector.add("中国好");vector.add("小日子");for (int i = 0; i <vector.size() ; i++) {System.out.println("数据是:"+vector.get(i));}
​}
}
3.1.4、Stack(栈)
public class StackTest {
​public static void main(String[] args){//这个其实是栈的数据结构
​Stack<String> list=new Stack<String>();list.push("1");list.push("2");list.push("3");list.push("4");list.push("5");
​System.out.println("pop:"+list.pop());System.out.println("pop:"+list.pop());System.out.println("pop:"+list.pop());System.out.println("pop:"+list.pop());System.out.println("pop:"+list.pop());
​}
}
3.2、Set集合
逻辑上 Set集合逻辑上是无序的  而且Set集合能排重  不能通过下标直接访问Set<E> 的爹 依然是Collection   Set这个接口是所有Set集合的爹Set排重的原则是啥?如果在Set集合中存放的是对象比如User 那么他就首先会去调用这个User中的 hashCode方法 然后获取到当前的这个要添加数据的hashCode值去和已经添加数据的HashCode值 做比较 如果是不等 那么说明肯定不是一个元素 那么直接添加元素  如果是HashCode值 遇到了在已经添加的数据中的HashCode值是相等的话 那么都说明有可能这个值是重复的 如果是这个值是重复的话 那就去调用当前这个对象的equals方法 判断equals方法是不是返回true  如果返回true 那么说明值重复  不添加数据  如果返回的是false  那么说明值 不重复 那么就可以添加数据
3.2.1、Set集合的排重问题(HashSet)
 public static void main(String[] args) {Set<String> set = new HashSet<>();set.add("123");set.add("345");set.add("234");set.add("345");System.out.println("数据的个数:" + set.size());System.out.println("-----------------------------");Set<User> setUser = new HashSet<>();setUser.add(new User(1, "小小", "112"));setUser.add(new User(1, "小小", "134"));setUser.add(new User(1, "小小", "165"));setUser.add(new User(1, "小小", "178"));System.out.println("数据的个数:" + setUser.size());}
public class User {private Integer id;private String username;private String password;
​public User(Integer id, String username, String password) {this.id = id;this.username = username;this.password = password;}
​public User() {}
​public Integer getId() {return id;}
​public void setId(Integer id) {this.id = id;}
​public String getUsername() {return username;}
​public void setUsername(String username) {this.username = username;}
​public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}
​@Overridepublic int hashCode() {return this.username.hashCode();}
​/*** 用户名一样 那么我们就认为这是同一个数据* @param obj* @return*/@Overridepublic boolean equals(Object obj) {if(obj instanceof User){User user= (User) obj;return this.username.equals(user.getUsername());}return false;}
}
3.2.2、Set集合的遍历问题(HashSet)
public class HashSetTest1 {
​public static void main(String[] args) {Set<User> set = new HashSet<>();set.add(new User(1,"xiaobobo","123"));set.add(new User(-1,"tiedan","777"));set.add(new User(3,"gousheng","0"));set.add(new User(4,"gouwa","234"));set.add(new User(1,"ergouzi","234"));
​//通过增强的for循环能访问for (User val:set){System.out.println("数据:"+val);}
​System.out.println("--------------------------");
​Iterator<User> it = set.iterator();while (it.hasNext()){User next = it.next();System.out.println("拿到的数据是:"+next);}
​System.out.println("--------------");set.stream().forEach(user -> {System.out.println("读取到的数据是:"+user);});}
}
​
3.2.3、LinkedHashSet的使用
这个集合的底层是链表
​
这个集合的数据保存是有序的
public class LinkedHashSetTest {public static void main(String[] args) {Set<User> set = new LinkedHashSet<>();set.add(new User(1, "xiaobobo", "123"));set.add(new User(-1, "tiedan", "777"));set.add(new User(3, "gousheng", "0"));set.add(new User(4, "gouwa", "234"));set.add(new User(1, "gouwa", "234"));Iterator<User> it = set.iterator();while (it.hasNext()) {User next = it.next();System.out.println(next);}}
}
3.2.4、TreeSet(底层实现是红黑树)
TreeSet和其他的Set集合一样 具有 排重的特性
​
TreeSet的底层是红黑树--->二叉树--->数据结构--->有大小关系
​
TreeSet集合自动具有排序的功能
​
这个排序 就涉及到一个大小的问题
​
自然数的大小  
​
字符串如何比较大小呢?  unicode编码值
3.2.5、两个字符串如何比较大小呢?通过编码
// 在String这个类中为我们提供了这个比较两个字符串大小的方法 
public static void main(String[] args) {String str = "Ab";String str2 = "Ab";/*** 返回值 0:表示的是前后相等* 返回值-1:表示的是前面小于后面* 返回值是1:表示的是前面大于后面*/System.out.println(str2.compareTo(str));
}
3.2.6、TreeSet的使用
TreeSet的底层使用的是红黑树来实现的
3.2.6.1、TreeSet的基本使用
package com.qfedu.edu.collection.set;
​
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
​
​
public class TreeSetTest {
​public static void main(String[] args) {Set<Integer> set = new TreeSet<>();set.add(123);set.add(0);set.add(345);set.add(77);set.add(77);set.add(89);
​//遍历这些数据Iterator<Integer> it = set.iterator();
​while (it.hasNext()) {Integer next = it.next();System.out.println("数据是:" + next);}
​//--------------下面研究字符串的排序------------System.out.println("-------------------");
​Set<String> setStr = new TreeSet<>();setStr.add("Abc");setStr.add("Bc");setStr.add("Ac");
​//遍历这些数据Iterator<String> it1 = setStr.iterator();
​while (it1.hasNext()) {String next = it1.next();System.out.println("数据是:" + next);}
​}
}
​
3.2.6.2、Comparable接口实现对象的比较

1、编写Employee对象

public class Employee implements Comparable<Employee>{
​private Integer id;private String name;private Integer salary;private String address;
​public Employee(Integer id, String name, Integer salary, String address) {this.id = id;this.name = name;this.salary = salary;this.address = address;}
​public Employee() {}
​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 getSalary() {return salary;}
​public void setSalary(Integer salary) {this.salary = salary;}
​public String getAddress() {return address;}
​public void setAddress(String address) {this.address = address;}
​/*** 比较的方法*    你需要按照谁排序 那么下面你就按照什么来比较**      我要通过薪资排序*         薪资是int类型 那么下面就直接做减法* @param o the object to be compared.* @return*/
//    @Override
//    public int compareTo(Employee o) {
//        return this.salary-o.getSalary();
//    }
​/*** 下面演示通过姓名来排序*  姓名是字符串类型* @param o the object to be compared.* @return*//*   @Overridepublic int compareTo(Employee o) {return this.getName().compareTo(o.getName());}*/
​/*** 如果薪资不为空 那么按照薪资排序*   如果薪资为空 并且姓名不为空 那么按照姓名排序*   如果姓名为空 那么就按照id排序....* @param o the object to be compared.* @return*/@Overridepublic int compareTo(Employee o) {if(o.getSalary()!=null){return this.getSalary()-o.getSalary();}else if(o.getName()!=null&&!("".equals(o.getName()))){return this.getName().compareTo(o.getName());}else{return this.id-o.getId();}}
​@Overridepublic String toString() {return "Employee{" +"id=" + id +", name='" + name + '\'' +", salary=" + salary +", address='" + address + '\'' +'}';}
}
​

2、编写测试类

public class TreeSetTest1 {
​public static void main(String[] args) {
​Set<Employee> set = new TreeSet<>();set.add(new Employee(1,"xiaobobo",3500,"四川成都"));set.add(new Employee(2,"xiaowangzi",1800,"四川巴中"));set.add(new Employee(3,"tiedan",2600,"四川自贡"));set.add(new Employee(4,"gousheng",15000,"四川绵阳"));set.add(new Employee(5,"gouwa",2700,"四川德阳"));
​
​Iterator<Employee> iterator = set.iterator();while (iterator.hasNext()){Employee next = iterator.next();System.out.println("获取到的数据是:"+next);}}
}
​
3.2.6.3、使用Comparator来实现对象的排序

1、对象的编写

public class Employee1{
​private Integer id;private String name;private Integer salary;private String address;
​public Employee1(Integer id, String name, Integer salary, String address) {this.id = id;this.name = name;this.salary = salary;this.address = address;}
​public Employee1() {}
​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 getSalary() {return salary;}
​public void setSalary(Integer salary) {this.salary = salary;}
​public String getAddress() {return address;}
​public void setAddress(String address) {this.address = address;}
​
​@Overridepublic String toString() {return "Employee{" +"id=" + id +", name='" + name + '\'' +", salary=" + salary +", address='" + address + '\'' +'}';}
}
​

2、测试的编写

package com.qfedu.edu.collection.set;
​
import com.qfedu.edu.pojo.Employee;
import com.qfedu.edu.pojo.Employee1;
​
import java.util.Comparator;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
​
/*** @author xiaobobo* @title: TreeSetTest* @projectName CD-Java-JY-2401-Simple-Parent* @description: 这个研究下TreeSet的对象的排序问题* @date 2024/3/19  15:26*/
public class TreeSetTest2 {
​public static void main(String[] args) {
​Set<Employee1> set = new TreeSet<>(new MyComparator());set.add(new Employee1(1,"xiaobobo",3500,"四川成都"));set.add(new Employee1(2,"xiaowangzi",1800,"四川巴中"));set.add(new Employee1(3,"tiedan",2600,"四川自贡"));set.add(new Employee1(4,"gousheng",15000,"四川绵阳"));set.add(new Employee1(5,"gouwa",2700,"四川德阳"));
​Iterator<Employee1> iterator = set.iterator();while (iterator.hasNext()){Employee1 next = iterator.next();System.out.println("获取到的数据是:"+next);}
​
​}
​
​/*** 自定义了一个比较器 这个跟上一个接口是一样的*/static class MyComparator implements Comparator<Employee1>{/**** @param o1 新数据* @param o2 老数据*  按照薪资排序  做减法 按照谁排序 就用谁来做比较* @return*/@Overridepublic int compare(Employee1 o1, Employee1 o2) {return o1.getSalary()-o2.getSalary();}}
}

4、双列的集合

相关文章:

集合深入------理解底层。

集合的使用 前提&#xff1a;栈、堆、二叉树、hashcode、toString()、quesalus()的知识深入和底层理解。 1、什么是集合 集合就是咋们所说的容器 ​ 前面我们学习过数组 数组也是容器 ​ 容器&#xff1a;装东西的 生活中有多少的容器呀? 水杯 教室 酒瓶 水库 只要是…...

【阅读笔记】《硬笔书法艺术》

硬笔书法基础教程&#xff0c;也介绍了一些实用案例 作者: 万应均 出版社: 湖南人民出版社 笔记 CH1 运笔方式 起笔&#xff1a;起笔、切笔、顺峰、搭峰。 行笔&#xff1a;提笔、按笔、滑笔、转笔、折笔。 收笔&#xff1a;提收、顿收、折收。 CH2 钢笔楷书 “古人善书者…...

5.5.5、【AI技术新纪元:Spring AI解码】使用PGvector设置向量存储及进行相似性搜索

使用PGvector设置向量存储及进行相似性搜索 本节指导您如何设置PGvector VectorStore来存储文档嵌入并执行相似性搜索。 PGvector是一个开源的PostgreSQL扩展,能够支持存储和搜索机器学习生成的嵌入向量,提供查找精确和近似最近邻的功能。它设计得与PostgreSQL的其他特性无…...

EDR下的线程安全

文章目录 前记进程断链回调执行纤程内存属性修改early birdMapping后记reference 前记 触发EDR远程线程扫描关键api&#xff1a;createprocess、createremotethread、void&#xff08;指针&#xff09;、createthread 为了更加的opsec&#xff0c;尽量采取别的方式执行恶意代…...

洛谷刷题 | B3623 枚举排列

枚举排列 题目描述 今有 n n n 名学生&#xff0c;要从中选出 k k k 人排成一列拍照。 请按字典序输出所有可能的排列方式。 输入格式 仅一行&#xff0c;两个正整数 n , k n, k n,k。 输出格式 若干行&#xff0c;每行 k k k 个正整数&#xff0c;表示一种可能的队…...

程序员35岁会失业吗?

程序员35岁会失业吗&#xff1f; 35岁被认为是程序员职业生涯的分水岭&#xff0c;许多程序员开始担忧自己的职业发展是否会受到年龄的限制。有人担心随着年龄的增长&#xff0c;技术更新换代的速度会使得资深程序员难以跟上&#xff1b;而另一些人则认为&#xff0c;丰富的经…...

RabbitMQ 安装保姆级教程

目录 1.MQ引言 1.1 什么是MQ 1.2 MQ有哪些 1.3 不同MQ特点 2.RabbitMQ 的引言 2.1 RabbitMQ 2.2 RabbitMQ 的安装 2.2.1 下载 2.2.2 下载的安装包 2.2.3 安装步骤 3. RabiitMQ 配置 3.1RabbitMQ 管理命令行 3.2 web管理界面介绍 3.2.1 overview概览 3.2.2 Admin用…...

【MySQL】InnoDB引擎

逻辑结构 InnoDB存储引擎逻辑结构如图所示&#xff1a; Tablespace&#xff1a;表空间&#xff0c;一个数据库可以对应多个表空间。数据库中的每张表都有一个表空间&#xff0c;用来存放表记录、索引等数据。 Segment&#xff1a;段&#xff0c;表空间中有多个段&#xff0c…...

小白如何兼职赚得第一桶金?六大网络赚钱方式助你轻松开启副业之旅

小白如何兼职赚得第一桶金&#xff1f;六大网络赚钱方式助你轻松开启副业之旅 无需担忧&#xff0c;以下为你精心挑选的六大线上兼职方式&#xff0c;将助你轻松开启副业赚钱之旅。 1&#xff0c;参与网络调查&#xff1a;市场调研公司及品牌商为洞察消费者需求&#xff0c;常…...

富格林:出金不顺谨防虚假受害

富格林悉知&#xff0c;做投资有盈有亏是正常的&#xff0c;投资者需要做的是尽可能降低亏损的风险&#xff0c;警惕虚假出金陷阱&#xff0c;避免造成不必要的亏损。在进入黄金投资市场之前&#xff0c;投资者需学习一定的投资技巧&#xff0c;并且需要采取正规的策略来打击和…...

Saltstack 最大打开文件数问题之奇怪的 8192

哈喽大家好&#xff0c;我是咸鱼。 今天分享一个在压测过程中遇到的问题&#xff0c;当时排查这个问题费了我们好大的劲&#xff0c;所以我觉得有必要写一篇文章来记录一下。 问题出现 周末在进行压测的时候&#xff0c;测试和开发的同事反映压测有问题&#xff0c;请求打到…...

Appium Inspector 展示设备当前页面

定位元素需要使用appium inspector&#xff0c;之前每次都是从登录页开始&#xff0c;后来发现连接设备的时候只需要去掉appPackage、appActivity即可。 { "platformName": "Android", "platformVersion": "6", "deviceNa…...

PyQt:实现菜单栏的点击拖动效果

一、整体步骤 1.设计UI文件 2.调用显示 3.效果展示 二、设计UI文件 1.添加 Scroll Area控件&#xff0c;作为菜单栏的布置区域 2.设置 Scroll Area控件的属性 3.Scroll Area控件内放置 按钮控件 组成菜单栏 此处&#xff0c;放置了需要了6个按钮&#xff0c;并设置按钮的固…...

力扣--并查集547.省份数量

思路分析&#xff1a; 首先定义变量 fa 用于记录并查集&#xff0c;以及城市数量 n。定义了并查集的两个函数&#xff0c;find 用于查找节点的根节点&#xff0c;togother 用于合并两个节点所在的集合。在公共函数 findCircleNum 中&#xff0c;初始化并查集&#xff0c;然后遍…...

leetcode35-Search Insert Position

排序数组搜索某个元素&#xff0c;这种思维一定要往二分法上靠 public class searchInsertPosition{public static void main(String[] args) {int arr[] {1,3,5,6};System.out.println(getIndex(arr,2));}public static int getIndex(int[] arr,int target) {int start 0;i…...

API 接口渗透测试

1 API 接口介绍 1.1 RPC&#xff08;远程过程调用&#xff09; 远程过程调用&#xff08;英语&#xff1a;Remote Procedure Call&#xff0c;缩写为 RPC&#xff09;是一个计算机通信协议。该协议允许运行于一台计算机的程序调用另一台计算机的子程序&#xff0c;而程序员无…...

oracle 19c单机版本补丁升级

文章目录 一、补丁包概述二、备份opatch三、替换高版本opatch四、打DB补丁1、关闭数据库2、关闭监听3、解压补丁4、冲突检测5、补丁空间检查6、执行补丁升级7、将更新内容加载到数据库8、最后查看数据库版本9、卸载补丁包 一、补丁包概述 补丁升级包 链接&#xff1a;https://…...

推荐系统的未来:大模型驱动的个性化推荐技术与挑战

推荐系统的未来&#xff1a;大模型驱动的个性化推荐技术与挑战 1. 背景介绍 推荐系统是现代互联网服务中不可或缺的一部分&#xff0c;它通过分析用户的历史行为和偏好&#xff0c;为用户提供个性化的内容推荐&#xff0c;从而提高用户体验和满意度。随着大数据、机器学习和人…...

Allegro许可管理工具

在数字化时代&#xff0c;软件许可管理成为企业面临的挑战之一。如何确保软件的合规使用、优化资源配置并降低运营成本是企业关注的焦点。Allegro许可管理工具作为一款强大的管理工具&#xff0c;为企业提供了全面、高效的解决方案。本文将深入探讨Allegro许可管理工具的卓越实…...

React函数组件Hook

问题: 相对于类组件, 函数组件的编码更简单, 效率也更高, 但函数组件不能有state (旧版) 解决: React 16.8版本设计了一套新的语法来让函数组件也可以有state Hook 是 React 16.8 的新增特性。它可以让你在不编写 class 的情况下使用 state 以及其他的 React 特性 Hook也叫钩子…...

19c补丁后oracle属主变化,导致不能识别磁盘组

补丁后服务器重启&#xff0c;数据库再次无法启动 ORA01017: invalid username/password; logon denied Oracle 19c 在打上 19.23 或以上补丁版本后&#xff0c;存在与用户组权限相关的问题。具体表现为&#xff0c;Oracle 实例的运行用户&#xff08;oracle&#xff09;和集…...

基于ASP.NET+ SQL Server实现(Web)医院信息管理系统

医院信息管理系统 1. 课程设计内容 在 visual studio 2017 平台上&#xff0c;开发一个“医院信息管理系统”Web 程序。 2. 课程设计目的 综合运用 c#.net 知识&#xff0c;在 vs 2017 平台上&#xff0c;进行 ASP.NET 应用程序和简易网站的开发&#xff1b;初步熟悉开发一…...

在rocky linux 9.5上在线安装 docker

前面是指南&#xff0c;后面是日志 sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo dnf install docker-ce docker-ce-cli containerd.io -y docker version sudo systemctl start docker sudo systemctl status docker …...

【单片机期末】单片机系统设计

主要内容&#xff1a;系统状态机&#xff0c;系统时基&#xff0c;系统需求分析&#xff0c;系统构建&#xff0c;系统状态流图 一、题目要求 二、绘制系统状态流图 题目&#xff1a;根据上述描述绘制系统状态流图&#xff0c;注明状态转移条件及方向。 三、利用定时器产生时…...

Map相关知识

数据结构 二叉树 二叉树&#xff0c;顾名思义&#xff0c;每个节点最多有两个“叉”&#xff0c;也就是两个子节点&#xff0c;分别是左子 节点和右子节点。不过&#xff0c;二叉树并不要求每个节点都有两个子节点&#xff0c;有的节点只 有左子节点&#xff0c;有的节点只有…...

Spring Cloud Gateway 中自定义验证码接口返回 404 的排查与解决

Spring Cloud Gateway 中自定义验证码接口返回 404 的排查与解决 问题背景 在一个基于 Spring Cloud Gateway WebFlux 构建的微服务项目中&#xff0c;新增了一个本地验证码接口 /code&#xff0c;使用函数式路由&#xff08;RouterFunction&#xff09;和 Hutool 的 Circle…...

rnn判断string中第一次出现a的下标

# coding:utf8 import torch import torch.nn as nn import numpy as np import random import json""" 基于pytorch的网络编写 实现一个RNN网络完成多分类任务 判断字符 a 第一次出现在字符串中的位置 """class TorchModel(nn.Module):def __in…...

Spring是如何解决Bean的循环依赖:三级缓存机制

1、什么是 Bean 的循环依赖 在 Spring框架中,Bean 的循环依赖是指多个 Bean 之间‌互相持有对方引用‌,形成闭环依赖关系的现象。 多个 Bean 的依赖关系构成环形链路,例如: 双向依赖:Bean A 依赖 Bean B,同时 Bean B 也依赖 Bean A(A↔B)。链条循环: Bean A → Bean…...

推荐 github 项目:GeminiImageApp(图片生成方向,可以做一定的素材)

推荐 github 项目:GeminiImageApp(图片生成方向&#xff0c;可以做一定的素材) 这个项目能干嘛? 使用 gemini 2.0 的 api 和 google 其他的 api 来做衍生处理 简化和优化了文生图和图生图的行为(我的最主要) 并且有一些目标检测和切割(我用不到) 视频和 imagefx 因为没 a…...

[大语言模型]在个人电脑上部署ollama 并进行管理,最后配置AI程序开发助手.

ollama官网: 下载 https://ollama.com/ 安装 查看可以使用的模型 https://ollama.com/search 例如 https://ollama.com/library/deepseek-r1/tags # deepseek-r1:7bollama pull deepseek-r1:7b改token数量为409622 16384 ollama命令说明 ollama serve #&#xff1a…...