Java集合sort排序报错UnsupportedOperationException处理

文章目录

    • 报错场景
    • 排查解决
    • UnmodifiableList类介绍

报错场景

  • 我们使用的是PostgreSQL数据库,存储业务数据,业务代码使用的是Spring JPA
  • 我们做的是智慧交通信控平台,有个功能是查询展示区域的交通态势,需要按照不同维度排序展示
  • 区域态势指标计算,15分钟一次,每次计算存储所有区域指标。我们的实时态势展示,每次展示当前最新结果
  • 业务要求,要按照区域交通流量、拥堵指数、拥堵里程分别倒序展示,写在了一个接口里,先查询后排序
  • 我们使用的默认自增的主键策略,故获取最新一次区域态势结果,可以使用id倒序,按照区域数量获取
  • 查询的业务逻辑比较简单,代码很快就写完了,使用JPA查询语句,构造查询和排序条件。得到查询结果list后,再根据业务需要,按照不同的字段排序
  • 但在部署测试环境后发现,排序代码执行报错,报错 null Not Implemented
  • 具体业务代码如下
    /*** 获取所有区域实时态势* @param targetIndex 排序字段* @return */public List<SituationAnalysisRegion> getCurrentRegionSituationList(String targetIndex) {// 获取所有子区List<SubRegion> allSubRegions = getAllSubRegion();Map<Integer, SubRegion> idSubRegionMap = new HashMap<>();allSubRegions.forEach(e -> idSubRegionMap.put(e.getId().intValue(), e));// 获取所有子区态势排名倒序Specification<SituationAnalysisRegion> specification = (root, query, cb)->{List<Predicate> predicates = new ArrayList<>();predicates.add(cb.greaterThan(root.get("timeStamp").as(Instant.class), LocalDateTime.now().plusMinutes(-15).plusSeconds(-30).atZone(ZoneId.systemDefault()).toInstant()));Predicate[] pre = new Predicate[predicates.size()];pre = predicates.toArray(pre);return query.where(pre).getRestriction();};Sort orders = Sort.by("id").descending();Pageable pageable = PageRequest.of(0, allSubRegions.size(), orders);List<SituationAnalysisRegion> situationAnalysisRegions = analysisRegionRepository.findAll(specification, pageable).getContent();// 排序要求if (null == targetIndex || StringUtils.isEmpty(targetIndex)) {situationAnalysisRegions.sort((o1, o2) -> (int)(o2.getCongestionMileage() - o1.getCongestionMileage()));} else if (targetIndex.equals("trafficFlow")) {situationAnalysisRegions.sort((o1, o2) -> o2.getTrafficFlow() - o1.getTrafficFlow());} else if (targetIndex.equals("congestionIndex")) {situationAnalysisRegions.sort((o1, o2) -> (int)(o2.getCongestionIndex() - o1.getCongestionIndex()));} else {situationAnalysisRegions.sort((o1, o2) -> (int)(o2.getCongestionMileage() - o1.getCongestionMileage()));}return situationAnalysisRegions;}
  • 具体报错日志如下:
2023-08-29 16:12:56.168 ERROR 12860 --- [  XNIO-1 task-1] o.z.problem.spring.common.AdviceTraits   : Not Implementedjava.lang.UnsupportedOperationException: nullat java.base/java.util.Collections$UnmodifiableList.sort(Collections.java:1332)at com.newatc.api.situationanalysis.service.SituationAnalysisRegionExtentService.getCurrentRegionSituationList(SituationAnalysisRegionExtentService.java:88)at com.newatc.api.situationanalysis.service.SituationAnalysisRegionExtentService.getRegionSituationList(SituationAnalysisRegionExtentService.java:104)at com.newatc.api.rest.SituationAnalysisController.getRegionSituationList(SituationAnalysisController.java:112)at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.base/java.lang.reflect.Method.invoke(Method.java:566)at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1070)at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)at javax.servlet.http.HttpServlet.service(HttpServlet.java:497)at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)at javax.servlet.http.HttpServlet.service(HttpServlet.java:584)at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)at com.newatc.api.redis.RequestFilter.doFilter(RequestFilter.java:58)at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122)at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.oauth2.client.web.OAuth2AuthorizationCodeGrantFilter.doFilterInternal(OAuth2AuthorizationCodeGrantFilter.java:168)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationFilter.doFilterInternal(BearerTokenAuthenticationFilter.java:125)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter.doFilterInternal(OAuth2AuthorizationRequestRedirectFilter.java:178)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:112)at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:82)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:275)at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:79)at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:79)at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387)at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:852)at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2019)at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1558)at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1449)at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)at java.base/java.lang.Thread.run(Thread.java:834)2023-08-29 16:12:56.227  WARN 12860 --- [  XNIO-1 task-1] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [java.lang.UnsupportedOperationException]

排查解决

  • 日志核心打印:Not Implementedjava.lang.UnsupportedOperationException: nullat java.base/java.util.Collections$UnmodifiableList.sort(Collections.java:1332)

  • 一开始看着报错null,以为是空指针异常,想着是不是没查询到数据,或者排序字段的值有null值

  • 查看了数据库数据,发现没问题,只好本地debug排查

  • 加了断点,进行debug,确认返回结果list有值,且排序字段也都有值,继续执行,还是这个报错

  • 想着要进行更细粒度的debug,于是按着 F5 继续调试,结果发现,也是直接一步走进报错,在这一行(Collections.sort)
    在这里插入图片描述

  • 一下子没法排查了,这个报错之前也没注意过,于是继续去网上搜索相应报错,还真找到了

  • 还是要回到报错日志,核心是这一句:at java.base/java.util.Collections$UnmodifiableList.sort(Collections.java:1332)

  • 在执行Collections.sort()方法时,发现传入的集合list,是一个不可修改的UnmodifiableList.,不能直接拿来排序

  • 但是可以通过新建一个list,来解决这个问题

        List<SituationAnalysisRegion> situationAnalysisRegions = analysisRegionRepository.findAll(specification, pageable).getContent();// 重新赋值,排除 UnmodifiableList 报错List<SituationAnalysisRegion> result = new ArrayList<>(situationAnalysisRegions);// 排序要求if (null == targetIndex || StringUtils.isEmpty(targetIndex)) {result.sort((o1, o2) -> (int)(o2.getCongestionMileage() - o1.getCongestionMileage()));} else if (targetIndex.equals("trafficFlow")) {result.sort((o1, o2) -> o2.getTrafficFlow() - o1.getTrafficFlow());} else if (targetIndex.equals("congestionIndex")) {result.sort((o1, o2) -> (int)(o2.getCongestionIndex() - o1.getCongestionIndex()));} else {result.sort((o1, o2) -> (int)(o2.getCongestionMileage() - o1.getCongestionMileage()));}return result;
  • 现在问题很明确了,JPA的查询代码,返回的list,是个不可修改的list。在网上查询该问题时,发现其他的一些类似查询,也可能返回一个不可修改的list,如 MongoDB的Java查询语句
  • 以后如果看到Collections$UnmodifiableList.sort报错,就要考虑到这种情况,都可以类似处理

UnmodifiableList类介绍

  • UnmodifiableList类是Collections的内部类
  • Java的Collections框架提供了UnmodifiableList类作为不可变列表的一种实现
  • UnmodifiableList实现了List接口,但是在其基础上增加了一些限制,例如不允许修改列表中的元素、不允许添加新元素以及不允许删除已有元素。因此,可以使用UnmodifiableList来保护某些关键数据,防止其他程序修改它们
  • 使用方式非常简单,通过Collections.unmodifiableList(List list)方法可以将一个可变的列表转换为一个不可变的列表,例如:
List<String> mutableList = new ArrayList<>();
mutableList.add("apple");
mutableList.add("banana");
mutableList.add("orange");List<String> immutableList = Collections.unmodifiableList(mutableList);
  • 这样,immutableList就成为了一个不可变的列表,任何尝试修改、添加或删除其中的元素的操作都会抛出UnsupportedOperationException异常。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/88674.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

同源策略与解决方法

同源策略与解决方法 1.浏览器的同源策略 1.1 同源策略 同源策略&#xff08;same origin policy&#xff09;&#xff0c;一种安全策略&#xff0c;用于限制一个源的文档或者它加载的脚本如何能与另一个源的资源进行交互。 浏览器默认两个不同的源之间是可以互相访问资源和…

Linux通过libudev获取挂载路径、监控U盘热拔插事件、U盘文件系统类型

文章目录 获取挂载路径监控U盘热拔插事件libusb 文件系统类型通过挂载点获取挂载路径添libudev加库 获取挂载路径 #include <stdio.h> #include <libudev.h> #include <string.h>int main() {struct udev *udev;struct udev_enumerate *enumerate;struct ud…

如何为winform控件注册事件

有很多winform的初学者不知道如何为winform注册的事件代码,本篇博文就是以button控件为例子,为winform注册单击事件,如下: 1、新建一个winform 以visual studio 2019 社区版为例子,新建一个winform程序,如下: 关于visual studio 2019 社区版下载方式点击这里:手把手教…

贝叶斯人工智能大脑与 ChatGPT

文章目录 一、前言二、主要内容 &#x1f349; CSDN 叶庭云&#xff1a;https://yetingyun.blog.csdn.net/ 一、前言 论文地址&#xff1a;https://arxiv.org/abs/2308.14732 这篇论文旨在研究 Chat Generative Pre-trained Transformer&#xff08;ChatGPT&#xff09;在贝叶斯…

阿姆达尔定律(Amdahl‘s Law)通俗解释

阿姆达尔定律&#xff08;Amdahl’s Law&#xff09;&#xff0c;它描述了在对系统的某个部分进行加速时&#xff0c;该部分对整体系统性能的影响&#xff0c;取决于该部分的重要性和加速程度。 原书给的例子不太好懂&#xff0c;下面是一个更好懂的例子。 例子&#xff1a;汽车…

C语言:指针类型的意义

1.指针的类型决定了解引用时访问几个字节 2.指针的类型决定了指针1、-1跳过几个字节 一、指针的类型决定指针解引用时访问几个字节 例如 int 型指针解引用时访问4个字节 char 型指针解引用时访问1个字节 详解代码如下&#xff1a; int b 0x11223344&#xff08;十六进制&…

MVVM架构模式

目录 一、MVVM简介二、MVVM结构三、MVC四、MVP五、MVVM的优势与存在的问题 一、MVVM简介 MVVM是Model-View-ViewModel的简写。即是模型-视图-视图模型。 MVVM架构模式是一种软件设计模式&#xff0c;它将应用程序分为三个部分&#xff1a;模型&#xff08;Model&#xff09;、…

【附安装包】CAD2024(建筑版)安装教程

软件下载 软件&#xff1a;CAD建筑版本&#xff1a;2023语言&#xff1a;简体中文大小&#xff1a;4.52G安装环境&#xff1a;Win11/Win10硬件要求&#xff1a;CPU2.5GHz 内存8G(或更高&#xff09;下载通道①百度网盘丨64位下载链接&#xff1a;https://pan.baidu.com/s/1cHe…

大数据治理运营整体解决方案[39页PPT]

导读&#xff1a;原文《大数据治理运营整体解决方案[39页PPT]》&#xff08;获取来源见文尾&#xff09;&#xff0c;本文精选其中精华及架构部分&#xff0c;逻辑清晰、内容完整&#xff0c;为快速形成售前方案提供参考。 数据治理总体方案 数据治理平台解决方案 数据治理运…

【推荐】Spring与Mybatis集成整合

目录 1.概述 2.集成 2.1代码演示&#xff1a; 3.整合 3.1概述 3.2 进行整合分页 接着上两篇&#xff0c;我已经写了Mybatis动态之灵活使用&#xff0c;mybatis的分页和特殊字符的使用方式接下来把它们集成起来&#xff0c;是如何的呢&#x1f447;&#x1f447;&#x1…

python 单向循环(环形)链表

不带头结点的单向循环链表的示意图 循环链表的应用场景【约瑟夫问题】 现假设 n 5&#xff08;一共有 5 个人&#xff09;&#xff0c;k 1&#xff08;从第 1 个人开始报数&#xff09;&#xff0c; m 2&#xff08;数 2 下&#xff09;&#xff0c;则出队编号的序列为&…

《存储IO路径》专题:IO虚拟化初探

大家好&#xff0c;欢迎来到今天的科技小课堂。今天我们要聊聊的是一项非常有趣且实用的技术——I/O虚拟化&#xff08;Input/Output Virtualization&#xff0c;简称IOV&#xff09;。想象一下&#xff0c;如果把物理硬件资源比作一道丰盛的大餐&#xff0c;那么IOV就是那位神…