压缩解压文件工具

一、maven依赖

<dependency><groupId>net.lingala.zip4j</groupId><artifactId>zip4j</artifactId><version>2.11.5</version></dependency>

二、工具类

package com.summer.toolkit.util;import com.summer.toolkit.exception.BizException;
import lombok.extern.slf4j.Slf4j;
import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.model.AbstractFileHeader;
import net.lingala.zip4j.model.FileHeader;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.model.enums.EncryptionMethod;
import org.apache.commons.lang3.StringUtils;import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;/*** @author author* @date 2024/7/4 18:32*/@Slf4j
public class ZipUtils {/*** 压缩单个文件* 或者向已有Zip文件中添加文件* 文件可以分开添加,即向同一个压缩包中添加一个文件1,解压密码也为1,再添加一个文件2,解压密码为2,再添加一个文件3,没有解压密码** @param fileName    要压缩的文件名* @param zipFileName 生成的压缩文件名* @throws BizException 压缩文件时发生异常*/public static void compressFile(String fileName, String zipFileName) {ZipUtils.compressFile(fileName, zipFileName, null);}/*** 压缩单个文件* 或者向已有Zip文件中添加文件** @param fileName       要压缩的文件名* @param zipFileName    生成的压缩文件名* @param passwordString 压缩文件的密码* @throws BizException 压缩文件时发生异常*/public static void compressFile(String fileName, String zipFileName, String passwordString) {// 密码不为空则加密文件ZipParameters zipParameters = StringUtils.isNotBlank(passwordString)? ZipUtils.getZipParameters(true): ZipUtils.getZipParameters(false);char[] password = StringUtils.isNotBlank(passwordString)? passwordString.toCharArray(): null;try (ZipFile zipFile = new ZipFile(zipFileName, password)) {zipFile.addFile(new File(fileName), zipParameters);} catch (IOException e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("压缩文件异常");}}/*** 压缩多个文件到一个压缩包中* 或者向已有Zip文件中添加多个文件** @param fileList    要压缩的文件列表* @param zipFileName 生成的压缩文件名* @throws BizException 如果压缩过程中发生错误*/public static void compressMultipleFiles(List<String> fileList, String zipFileName) {ZipUtils.compressMultipleFiles(fileList, zipFileName, null);}/*** 压缩多个文件到一个压缩包中* 或者向已有Zip文件中添加多个文件** @param fileList       要压缩的文件列表* @param zipFileName    生成的压缩文件名* @param passwordString 压缩文件的密码* @throws BizException 如果压缩过程中发生错误*/public static void compressMultipleFiles(List<String> fileList, String zipFileName, String passwordString) {// 密码不为空则加密文件ZipParameters zipParameters = StringUtils.isNotBlank(passwordString)? ZipUtils.getZipParameters(true): ZipUtils.getZipParameters(false);char[] password = StringUtils.isNotBlank(passwordString)? passwordString.toCharArray(): null;List<File> filesToAdd = new ArrayList<>();for (String originFile : fileList) {filesToAdd.add(new File(originFile));}try (ZipFile zipFile = new ZipFile(zipFileName, password)) {zipFile.addFiles(filesToAdd, zipParameters);} catch (IOException e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("压缩文件异常");}}/*** 创建切分zip文件* 如果您想在大小超过特定限制时将zip文件拆分为多个文件可以使用此方法** @param fileList    要压缩的文件列表* @param zipFileName 生成的压缩文件名* @throws BizException 如果压缩过程中发生错误*/public static void createSplitZipFile(List<String> fileList, String zipFileName) {long splitLength = 100 * 1024 * 1024;ZipUtils.createSplitZipFile(fileList, zipFileName, splitLength);}/*** 创建切分zip文件* 如果您想在大小超过特定限制时将zip文件拆分为多个文件可以使用此方法** @param fileList    要压缩的文件列表* @param zipFileName 生成的压缩文件名* @param splitLength 切分文件大小* @throws BizException 如果压缩过程中发生错误*/public static void createSplitZipFile(List<String> fileList, String zipFileName, long splitLength) {ZipUtils.createSplitZipFile(fileList, zipFileName, null, splitLength);}/*** 创建切分zip文件* 如果您想在大小超过特定限制时将zip文件拆分为多个文件可以使用此方法** @param fileList       要压缩的文件列表* @param zipFileName    生成的压缩文件名* @param passwordString 压缩文件的密码* @throws BizException 如果压缩过程中发生错误*/public static void createSplitZipFile(List<String> fileList, String zipFileName, String passwordString) {// 默认100Mlong splitLength = 100 * 1024 * 1024;ZipUtils.createSplitZipFile(fileList, zipFileName, passwordString, splitLength);}/*** 创建切分zip文件* 如果您想在大小超过特定限制时将zip文件拆分为多个文件可以使用此方法** @param fileList       要压缩的文件列表* @param zipFileName    生成的压缩文件名* @param passwordString 压缩文件的密码* @param splitLength    切分文件大小* @throws BizException 如果压缩过程中发生错误*/public static void createSplitZipFile(List<String> fileList, String zipFileName, String passwordString, long splitLength) {// 密码不为空则加密文件ZipParameters zipParameters = StringUtils.isNotBlank(passwordString)? ZipUtils.getZipParameters(true): ZipUtils.getZipParameters(false);char[] password = StringUtils.isNotBlank(passwordString)? passwordString.toCharArray(): null;List<File> filesToAdd = new ArrayList<>();for (String originFile : fileList) {filesToAdd.add(new File(originFile));}try (ZipFile zipFile = new ZipFile(zipFileName, password)) {zipFile.createSplitZipFile(filesToAdd, zipParameters, true, splitLength);} catch (IOException e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("压缩文件异常");}}/*** 创建切分zip文件* 如果您想在大小超过特定限制时将zip文件拆分为多个文件可以使用此方法** @param folder      要压缩的文件夹* @param zipFileName 生成的压缩文件名* @throws BizException 如果压缩过程中发生错误*/public static void createSplitZipFileFromFolder(String folder, String zipFileName) {// 默认100Mlong splitLength = 100 * 1024 * 1024;ZipUtils.createSplitZipFileFromFolder(folder, zipFileName, null, splitLength);}/*** 创建切分zip文件* 如果您想在大小超过特定限制时将zip文件拆分为多个文件可以使用此方法** @param folder         要压缩的文件夹* @param zipFileName    生成的压缩文件名* @param passwordString 压缩文件的密码* @throws BizException 如果压缩过程中发生错误*/public static void createSplitZipFileFromFolder(String folder, String zipFileName, String passwordString) {long splitLength = 100 * 1024 * 1024;ZipUtils.createSplitZipFileFromFolder(folder, zipFileName, passwordString, splitLength);}/*** 创建切分zip文件* 如果您想在大小超过特定限制时将zip文件拆分为多个文件可以使用此方法** @param folder         要压缩的文件夹* @param zipFileName    生成的压缩文件名* @param passwordString 压缩文件的密码* @param splitLength    切分文件大小* @throws BizException 如果压缩过程中发生错误*/public static void createSplitZipFileFromFolder(String folder, String zipFileName, String passwordString, long splitLength) {// 密码不为空则加密文件ZipParameters zipParameters = StringUtils.isNotBlank(passwordString)? ZipUtils.getZipParameters(true): ZipUtils.getZipParameters(false);char[] password = StringUtils.isNotBlank(passwordString)? passwordString.toCharArray(): null;try (ZipFile zipFile = new ZipFile(zipFileName, password)) {zipFile.createSplitZipFileFromFolder(new File(folder), zipParameters, false, splitLength);} catch (IOException e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("压缩文件异常");}}/*** 压缩指定文件夹到一个zip文件中** @param folder      待压缩文件夹的路径* @param zipFileName 生成的zip文件的名称* @throws BizException 当压缩过程中发生错误时抛出*/public static void compressFolder(String folder, String zipFileName) {ZipUtils.compressFolder(folder, zipFileName, null);}/*** 压缩指定文件夹到一个zip文件中** @param folder         待压缩文件夹的路径* @param zipFileName    生成的zip文件的名称* @param passwordString 压缩文件的密码* @throws BizException 当压缩过程中发生错误时抛出*/public static void compressFolder(String folder, String zipFileName, String passwordString) {// 密码不为空则加密文件ZipParameters zipParameters = StringUtils.isNotBlank(passwordString)? ZipUtils.getZipParameters(true): ZipUtils.getZipParameters(false);char[] password = StringUtils.isNotBlank(passwordString)? passwordString.toCharArray(): null;try (ZipFile zipFile = new ZipFile(zipFileName, password)) {zipFile.addFolder(new File(folder), zipParameters);} catch (Exception e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("压缩文件异常");}}/*** 压缩输入流到指定的ZIP文件** @param inputStream 输入流,表示要压缩的文件数据* @param zipFileName 压缩后的ZIP文件名* @throws BizException 如果在压缩过程中发生IO异常*/public static void compressInputStream(InputStream inputStream, String zipFileName, String fileNameInZip) {ZipUtils.compressInputStream(inputStream, zipFileName, fileNameInZip, null);}/*** 压缩输入流到指定的ZIP文件,并使用可选的密码保护** @param inputStream    输入流,表示要压缩的文件数据* @param zipFileName    压缩后的ZIP文件名* @param passwordString 可选的密码,如果为空则不使用密码保护* @throws BizException 如果在压缩过程中发生IO异常*/public static void compressInputStream(InputStream inputStream, String zipFileName, String fileNameInZip, String passwordString) {// 密码不为空则加密文件ZipParameters zipParameters = StringUtils.isNotBlank(passwordString)? ZipUtils.getZipParameters(true): ZipUtils.getZipParameters(false);char[] password = StringUtils.isNotBlank(passwordString)? passwordString.toCharArray(): null;zipParameters.setFileNameInZip(fileNameInZip);try (ZipFile zipFile = new ZipFile(zipFileName, password)) {zipFile.addStream(inputStream, zipParameters);} catch (IOException e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("压缩文件异常");}}/*** 获取Zip参数配置** @param encryptFiles 是否加密文件* @return ZipParameters 配置的Zip参数*/public static ZipParameters getZipParameters(boolean encryptFiles) {ZipParameters zipParameters = new ZipParameters();zipParameters.setEncryptFiles(encryptFiles);zipParameters.setEncryptionMethod(EncryptionMethod.ZIP_STANDARD);return zipParameters;}/*** 解压缩指定的文件中的某个文件到目标路径** @param zipFileName     ZIP 文件的名称* @param fileNameInZip   需要解压的文件名称* @param destinationPath 解压后文件的目标路径* @throws BizException 如果解压过程中出现异常*/public static void extractFile(String zipFileName, String fileNameInZip, String destinationPath) {ZipUtils.extractFile(zipFileName, fileNameInZip, destinationPath, null);}/*** 解压指定的ZIP文件中的某个文件到目标路径** @param zipFileName     ZIP文件的名称* @param passwordString  解压ZIP文件所需的密码* @param fileNameInZip   需要解压的文件名称* @param destinationPath 解压后的目标路径* @throws BizException 如果解压过程中发生异常*/public static void extractFile(String zipFileName, String fileNameInZip, String destinationPath, String passwordString) {char[] password = StringUtils.isNotBlank(passwordString)? passwordString.toCharArray(): null;try (ZipFile zipFile = new ZipFile(zipFileName, password)) {zipFile.extractFile(fileNameInZip, destinationPath);} catch (Exception e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("解压文件异常");}}/*** 解压缩指定的文件到目标路径** @param zipFileName     ZIP 文件的名称* @param destinationPath 解压后文件的目标路径* @throws BizException 如果解压过程中出现异常*/public static void extractAllFile(String zipFileName, String destinationPath) {ZipUtils.extractAllFile(zipFileName, destinationPath, null);}/*** 解压指定的ZIP文件到目标路径。** @param zipFileName     ZIP文件的名称* @param passwordString  解压ZIP文件所需的密码* @param destinationPath 解压后的目标路径* @throws BizException 如果解压过程中发生异常*/public static void extractAllFile(String zipFileName, String destinationPath, String passwordString) {char[] password = StringUtils.isNotBlank(passwordString)? passwordString.toCharArray(): null;try (ZipFile zipFile = new ZipFile(zipFileName, password)) {zipFile.extractAll(destinationPath);} catch (Exception e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("解压文件异常");}}/*** 从压缩包中获取文件流** @param zipFileName   压缩后的ZIP文件名* @param fileNameInZip 输入流,表示要压缩的文件数据* @throws BizException 如果在压缩过程中发生IO异常*/public static InputStream getInputStreamFromZip(String zipFileName, String fileNameInZip) {return ZipUtils.getInputStreamFromZip(zipFileName, fileNameInZip, null);}/*** 从压缩包中获取文件流** @param zipFileName   压缩后的ZIP文件名* @param fileNameInZip 输入流,表示要压缩的文件数据* @throws BizException 如果在压缩过程中发生IO异常*/public static InputStream getInputStreamFromZip(String zipFileName, String fileNameInZip, String passwordString) {char[] password = StringUtils.isNotBlank(passwordString)? passwordString.toCharArray(): null;try (ZipFile zipFile = new ZipFile(zipFileName, password)) {FileHeader fileHeader = zipFile.getFileHeader(fileNameInZip);return zipFile.getInputStream(fileHeader);} catch (IOException e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("从压缩包中获取文件流异常");}}/*** 列出ZIP文件中的所有文件名* 列出文件名也不需要密码** @param zipFileName ZIP文件的文件名* @return ZIP文件中所有文件名的列表* @throws BizException 如果在处理ZIP文件时发生异常*/public static List<String> listAllFilesInZip(String zipFileName) {try (ZipFile zipFile = new ZipFile(zipFileName)) {List<FileHeader> fileHeaders = zipFile.getFileHeaders();return fileHeaders.stream().map(AbstractFileHeader::getFileName).toList();} catch (Exception e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("列出ZIP文件中的所有文件名异常");}}/*** 从压缩文件中移除指定文件* 删除文件无须密码** @param zipFileName   压缩文件的名称* @param fileNameInZip 压缩文件中要移除的文件的名称* @throws BizException 当移除文件时发生异常*/public static void removeFileFromZip(String zipFileName, String fileNameInZip) {try (ZipFile zipFile = new ZipFile(zipFileName)) {zipFile.removeFile(fileNameInZip);} catch (Exception e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("从压缩包中移除文件异常");}}/*** 设置压缩文件的注释** @param zipFileName 压缩文件的文件名* @param comment     要设置的注释内容* @throws BizException 当设置注释时发生异常*/public static void setCommentForZip(String zipFileName, String comment) {try (ZipFile zipFile = new ZipFile(zipFileName)) {zipFile.setComment(comment);} catch (Exception e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("设置压缩文件的注释异常");}}/*** 获取压缩文件的注释** @param zipFileName 压缩文件的文件名* @throws BizException 当设置注释时发生异常*/public static String getCommentForZip(String zipFileName) {try (ZipFile zipFile = new ZipFile(zipFileName)) {return zipFile.getComment();} catch (Exception e) {log.error("ZipUtils error {}", e.getMessage(), e);throw new BizException("获取压缩文件的注释异常");}}}

三、测试类

@Testpublic void testCompressFile() {String filePath = "D:\\mytmp\\1948321_通用计费报表\\";String name = "1963692_通用计费报表_1.csv";String fileName = filePath + name;String zipFileName = filePath + "通用计费报表1.zip";String zipFileName2 = filePath + "通用计费报表2.zip";String zipFileName3 = filePath + "12.txt";ZipUtils.compressFile(fileName, zipFileName);ZipUtils.setCommentForZip(zipFileName, "abcdefghi123");System.out.println(ZipUtils.getCommentForZip(zipFileName));//ZipUtils.compressFile(fileName, zipFileName2, "123456");//ZipUtils.compressFile(zipFileName, zipFileName2, "123456");//ZipUtils.compressFile(zipFileName3, zipFileName2, "123456");ZipUtils.compressFile(fileName, zipFileName2);ZipUtils.compressFile(zipFileName, zipFileName2);ZipUtils.compressFile(zipFileName3, zipFileName2);List<String> files = ZipUtils.listAllFilesInZip(zipFileName2);System.out.println(JSON.toJSONString(files));ZipUtils.removeFileFromZip(zipFileName2, files.get(0));List<String> files2 = ZipUtils.listAllFilesInZip(zipFileName2);System.out.println(JSON.toJSONString(files2));ZipUtils.extractAllFile(zipFileName2, "D:\\mytmp\\excel");//ZipUtils.extractAllFile(zipFileName2, "D:\\mytmp\\excel", "123456");}

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

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

相关文章

Day05-03-Nexus仓库

Day05-03-Nexus仓库 05-nexus-仓库1. 概述2. 极速部署指南2.1 下载2.2 部署2.3 配置2.4 连接使用nexus2.4 编译与测试 3. 总结 05-nexus-仓库 1. 概述 背景: maven编译的时候&#xff0c;npm/cnpm编译&#xff0c;需要下载大量的依赖包。这些依赖包在每一次构建的时候都需要使…

React 省市查询组件完整代码

目录 一、地区文件 二、Antd配合使用 三、实现效果 一、地区文件 下载地址&#xff1a;全国省市区数据_JSON格式_SQL格式 export const chinaArea {0: {1: 北京,2: 天津,3: 河北省,4: 山西省,5: 内蒙古自治区,6: 辽宁省,7: 吉林省,8: 黑龙江省,9: 上海,10: 江苏省,11: 浙…

Perl 语言入门学习指南:探索高效脚本编程的奥秘

引言 Perl&#xff0c;全称Practical Extraction and Report Language&#xff0c;是一种功能强大的编程语言&#xff0c;特别擅长于文本处理、报告生成以及系统自动化管理任务。自1987年诞生以来&#xff0c;Perl凭借其灵活性、强大的内置功能库和广泛的社区支持&#xff0c;…

维护和管理LDAP之OpenDJ

目录 基本介绍 服务专有名词 安装 命令行工具 密码管理 重置管理员密码 管理服务器进程 管理索引 如何搜索 管理索引 管理目录数据 测试数据 导出数据 导入数据 LDIF文件数据查看和比较 数据存储-Backends 配置连接 开启 HTTP/HTTPS连接 使用 REST访问 -open…

Spring AOP、Spring MVC工作原理、发展演变、常用注解

Spring AOP 概念 AOP全称为Aspect Oriented Programming&#xff0c;表示面向切面编程。切面指的是将那些与业务无关&#xff0c;但业务模块都需要使用的功能封装起来的技术。 AOP基本术语 **连接点&#xff08;Joinpoint&#xff09;&#xff1a;**连接点就是被拦截到的程序执…

AQWA | 水动力分析 二阶波浪力

&#x1f3c6;本文收录于「Bug调优」专栏&#xff0c;主要记录项目实战过程中的Bug之前因后果及提供真实有效的解决方案&#xff0c;希望能够助你一臂之力&#xff0c;帮你早日登顶实现财富自由&#x1f680;&#xff1b;同时&#xff0c;欢迎大家关注&&收藏&&…

Midjourney对图片细微调整和下载保存

点击v2是对第二图片细微调整。 点击u3对第3张图片进行放大。 保存图片: 对点击u3放大的图片&#xff0c;双击 , 右键保存图片

停车场小程序的设计

管理员账户功能包括&#xff1a;系统首页&#xff0c;个人中心&#xff0c;车主管理&#xff0c;商家管理&#xff0c;停车场信息管理&#xff0c;预约停车管理&#xff0c;商场收费管理&#xff0c;留言板管理 微信端账号功能包括&#xff1a;系统首页&#xff0c;停车场信息…

审核平台前端新老仓库迁移

背景 审核平台接入50业务&#xff0c;提供在线审核及离线质检、新人培训等核心能力&#xff0c;同时提供数据报表、资源追踪、知识库等工具。随着平台的飞速发展&#xff0c;越来越多的新业务正在或即将接入审核平台&#xff0c;日均页面浏览量为百万级别。如今审核平台已是公司…

代码提交错分支了怎么办?

你有么有遇到过正在开发的代码&#xff0c;提交到生产环境的分支去&#xff0c;遇到这种情况怎么办&#xff1f; 问题重现&#xff1a; 这段注释// AAAAAAAAAAA 本来应该写在dev分支的&#xff0c;现在提交并push到master分支了 现在第一步&#xff0c;撤回提交 第二步&…

第1章 认识 Vite

明白了&#xff0c;这里是第1章内容的详细展开版本&#xff1a; 第1章 认识 Vite 1 . 什么是 Vite Vite 是一个由尤雨溪&#xff08;Vue.js 的创始人&#xff09;开发的前端构建工具&#xff0c;旨在提供极快的开发体验。Vite 的名字来源于法语&#xff0c;意为“快速”&…

python绘制一维离散点

在Python中&#xff0c;绘制一维离散点通常意味着我们要在一条直线上标记出几个特定的点。这可以通过多种库来实现&#xff0c;但最常见和强大的库之一是matplotlib。以下是一个详细的代码示例&#xff0c;它展示了如何使用matplotlib库来绘制一维离散点&#xff0c;并且这个示…

C++语言常见错误分析汇总

在一个工程里出现两个main函数时 3.obj : error LNK2005: _main already defined in file1.obj Debug/HELLO.exe : fatal error LNK1169: one or more multiply defined symbols found 这个就是说&#xff0c;你的main函数重定义了。你看看是不是你的工程里面&#xff0c;包…

MySQL的Geometry数据处理之WKB方案

MySQL的Geometry数据处理之WKT方案&#xff1a;https://blog.csdn.net/qq_42402854/article/details/140134357 MySQL的Geometry数据处理之WKT方案中&#xff0c;介绍WTK方案的优点&#xff0c;也感受到它的繁琐和缺陷。比如&#xff1a; 需要借助 ST_GeomFromText和 ST_AsTex…

Spring @Cacheable缓存注解用法说明

注解Cacheable 是 Spring 框架中用于缓存数据的方法或类的注解。通过使用这个注解&#xff0c;你可以避免重复计算和重复获取数据&#xff0c;从而提高应用程序的性能。 基本用法 引入依赖 确保在你的项目中引入了 Spring Cache 相关的依赖。如果你使用的是 Spring Boot&…

中英双语介绍中国的城市:上海市(Shanghai)

中文版 上海市是中国最大的城市之一&#xff0c;也是全球重要的金融、贸易和航运中心。作为一座现代化的国际大都市&#xff0c;上海以其繁华的商业区、丰富的文化遗产和多样化的经济结构而闻名。以下是对上海市的详细介绍&#xff0c;包括其地理位置、人口、经济、教育、文化…

qt结合vs2022安装

进入清华大学开源软件&#xff1a; 清华大学开源软件镜像站 | Tsinghua Open Source Mirror 下载完成后&#xff0c;双击进行安装&#xff1a; 进入邮箱进行验证&#xff1a; 可能是因为网络问题&#xff0c;无法安装。 重新安装5.12.12版本。 安装后启动失败&#xff0c;重新…

后端接口设计考虑要点

1. 接口参数校验 入参校验&#xff1a;确保必要参数不为空&#xff0c;限制长度和格式&#xff08;例如邮箱格式&#xff09;。返回值校验&#xff1a;确定返回值不为空&#xff0c;为空时返回与前端协商的默认值。 2. 接口扩展性 设计通用接口而非仅针对特定业务流程的接口…

横截面交易策略:概念与示例

数量技术宅团队在CSDN学院推出了量化投资系列课程 欢迎有兴趣系统学习量化投资的同学&#xff0c;点击下方链接报名&#xff1a; 量化投资速成营&#xff08;入门课程&#xff09; Python股票量化投资 Python期货量化投资 Python数字货币量化投资 C语言CTP期货交易系统开…

数据结构--单链表实现

欢迎光顾我的homepage 前言 链表和顺序表都是线性表的一种&#xff0c;但是顺序表在物理结构和逻辑结构上都是连续的&#xff0c;但链表在逻辑结构上是连续的&#xff0c;而在物理结构上不一定连续&#xff1b;来看以下图片来认识链表与顺序表的差别 这里以动态顺序表…