List基础与难度题

1. 向 ArrayList 中添加元素并打印

  • 功能描述
    • 程序创建一个空的 ArrayList 集合,用于存储字符串类型的元素。
    • 向该 ArrayList 中依次添加指定的字符串元素。
    • 使用增强型 for 循环遍历 ArrayList 中的所有元素,并将每个元素打印输出到控制台。
  • 测试数据描述
    • 预期向 ArrayList 中添加的字符串元素为 "apple""banana""cherry"
    • 预期控制台输出为:
import java.util.ArrayList;
import java.util.List;public class ArrayListAdd {public static void main(String[] args) {List fruit = new ArrayList();String fruit1 = "apple";String fruit2 = "banana";String fruit3 = "cherry";fruit.add(fruit1);fruit.add(fruit2);fruit.add(fruit3);for (Object fruitNum : fruit) {System.out.println(fruitNum);}}
}

2. 从 HashSet 中移除重复元素

  • 功能描述
    • 首先创建一个 ArrayList 并向其中添加包含重复元素的字符串。
    • 然后利用 HashSet 的特性(HashSet 不允许存储重复元素),将 ArrayList 中的元素添加到 HashSet 中,自动去除重复元素。
    • 最后遍历 HashSet 并将其中的元素打印到控制台,验证重复元素已被成功移除。
  • 测试数据描述
    • ArrayList 中添加的字符串元素为 "apple""banana""apple",其中 "apple" 为重复元素。
    • 预期 HashSet 中存储的元素为 "apple""banana"(元素顺序可能不同,因为 HashSet 是无序的)。
    • 预期控制台输出类似(元素顺序不固定):

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;public class HashSetRemove {public static void main(String[] args) {List fruit = new ArrayList();String fruit1 = "apple";String fruit2 = "banana";String fruit3 = "apple";String fruit4 = "apple";fruit.add(fruit1);fruit.add(fruit2);fruit.add(fruit3);fruit.add(fruit4);for (Object fruitNum : fruit) {System.out.println(fruitNum);}System.out.println("====================");Set fruitNew = new HashSet();for (Object fruitNum : fruit) {fruitNew.add(fruitNum);}System.out.println(fruitNew);}
}

3. 使用 HashMap 统计单词出现次数

  • 功能描述
    • 给定一个字符串数组,程序创建一个 HashMap 用于统计每个单词在数组中出现的次数。
    • 遍历字符串数组,对于每个单词,在 HashMap 中检查该单词是否已存在。如果存在,则将其对应的值加 1;如果不存在,则将该单词作为键,值设为 1 存入 HashMap
    • 最后遍历 HashMap 的键值对,将每个单词及其出现的次数打印到控制台。
  • 测试数据描述
    • 给定的字符串数组为 {"apple", "banana", "apple", "cherry", "banana", "apple"}
    • 预期 HashMap 中的统计结果为:"apple" -> 3"banana" -> 2"cherry" -> 1
    • 预期控制台输出类似(顺序不固定):
import java.util.HashMap;
import java.util.Map;public class HashMap_collection {public static void main(String[] args) {String [] fruits = {"apple", "banana", "apple", "cherry", "banana", "apple"};Map<String,Integer> fruitMap = new HashMap<>();for (String fruit : fruits) {if (fruitMap.containsKey(fruit)) {// 如果单词已存在于 HashMap 中,将其对应的值加 1fruitMap.put(fruit, fruitMap.get(fruit) + 1);} else {// 如果单词不存在于 HashMap 中,将该单词作为键,值设为 1 存入 HashMapfruitMap.put(fruit, 1);}}//        int j = 0;
//        int k = 0;
//        int z = 0;
//        for (int i=0; i < fruit.length; i++) {
//            if (fruit[i].equals("apple")){
//                fruitMap.put("apple",j+=1);
//            }else if (fruit[i].equals("banana")){
//                fruitMap.put("banana",k+=1);
//            }else if (fruit[i].equals("cherry")){
//                fruitMap.put("cherry",z+=1);
//            }
//        }System.out.println(fruitMap);}
}

 

4. 合并两个 HashMap

  • 功能描述
    • 分别创建两个 HashMap,用于存储字符串类型的键和整数类型的值。
    • 将第一个 HashMap 的内容复制到一个新的 HashMap 中作为合并的基础。
    • 遍历第二个 HashMap 的键值对,对于每个键,如果在新的 HashMap 中已存在该键,则将对应的值相加;如果不存在,则将该键值对直接存入新的 HashMap
    • 最后遍历合并后的 HashMap,将每个键及其对应的值打印到控制台。
  • 测试数据描述
    • 第一个 HashMapmap1)的键值对为 {"apple" -> 3, "banana" -> 2}
    • 第二个 HashMapmap2)的键值对为 {"apple" -> 2, "cherry" -> 1}
    • 预期合并后的 HashMap 键值对为 {"apple" -> 5, "banana" -> 2, "cherry" -> 1}
    • 预期控制台输出类似(顺序不固定):
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;public class HashMap_combine {public static void main(String[] args) {Map<String,Integer> fruitMap1 = new HashMap<>();Map<String,Integer> fruitMap2 = new HashMap<>();Map<String,Integer> fruitMap3 = new HashMap<>();fruitMap1.put("apple",3);fruitMap1.put("banana",2);fruitMap2.put("apple",2);fruitMap2.put("cherry",1);Iterator it = fruitMap1.keySet().iterator();while(it.hasNext()){String fruitKey = (String) it.next();fruitMap3.put(fruitKey,fruitMap1.get(fruitKey));}System.out.println("map1:"+fruitMap1);System.out.println("map2:"+fruitMap2);System.out.println("map3:"+fruitMap3);Iterator it1 = fruitMap2.keySet().iterator();while(it1.hasNext()){String fruitKey1 = (String) it1.next();if (fruitMap3.containsKey(fruitKey1)){fruitMap3.put(fruitKey1,fruitMap3.get(fruitKey1)+fruitMap2.get(fruitKey1));}else {fruitMap3.put(fruitKey1, fruitMap2.get(fruitKey1));}}System.out.println(fruitMap3);}}

 

5. 实现一个简单的图书管理系统

  • 功能描述
    • 定义一个 Book 类,用于表示图书,包含图书的标题和作者属性。
    • 定义一个 Library 类,包含一个用于存储 Book 对象的 ArrayListLibrary 类提供以下方法:
      • addBook(Book book):向图书馆的图书列表中添加一本图书。
      • removeBook(Book book):从图书馆的图书列表中移除一本图书。
      • findBook(String title):根据图书标题在图书馆的图书列表中查找图书,如果找到则返回对应的 Book 对象,否则返回 null
      • displayAllBooks():遍历图书馆的图书列表,将每本图书的信息(标题和作者)打印到控制台。
    • 在 LibrarySystem 类的 main 方法中,进行以下操作:
      • 创建一个 Library 对象。
      • 向图书馆中添加几本图书。
      • 显示图书馆中所有的图书信息。
      • 根据图书标题查找一本图书,并显示查找结果。
      • 从图书馆中移除找到的图书,然后再次显示图书馆中所有的图书信息,验证图书已被成功移除。
  • 测试数据描述
    • 预期添加到图书馆的图书为:
      • 第一本图书:标题为 "Java Programming",作者为 "John Doe"
      • 第二本图书:标题为 "Python Crash Course",作者为 "Jane Smith"
    • 预期第一次显示所有图书时,控制台输出为:
Title: Java Programming, Author: John Doe
Title: Python Crash Course, Author: Jane Smith
  • 预期查找图书 "Java Programming" 时,能找到对应的 Book 对象。
  • 预期移除找到的图书后,再次显示所有图书时,控制台输出为:
Title: Python Crash Course, Author: Jane Smith

 Book类

public class Book {private String title;private String Author;public Book() {}public Book(String title, String author) {this.title=title;Author=author;}public String getTitle() {return title;}public void setTitle(String title) {this.title=title;}public String getAuthor() {return Author;}public void setAuthor(String author) {Author=author;}
}

Library类

import java.util.ArrayList;
import java.util.HashMap;public class Library {//ArrayListprivate ArrayList<Book> books;public Library() {this.books = new ArrayList<>();}public void addBook(Book book){books.add(book);}public void removeBook(Book book){books.remove(book);}public Book findBook(String title){for (Book book : books) {if (book.getTitle().equals(title)){return book;}}return null;}public void displayAllBooks(){for (Book book : books) {System.out.println("Title:"+book.getTitle()+",Author:"+book.getAuthor());}}//    //HashMap
//    private HashMap<String, Book> books;
//
//    public Library() {
//        this.books = new HashMap<>();
//    }
//
//    public void addBook(Book book) {
//        books.put(book.getTitle(), book);
//    }
//
//    public void removeBook(Book book) {
//        books.remove(book.getTitle());
//    }
//
//    public Book findBook(String title) {
//        return books.get(title);
//    }
//
//    public void displayAllBooks() {
//        for (Book book : books.values()) {
//            System.out.println(book);
//        }
//    }
}

Test类

public class test {public static void main(String[] args) {Library library = new Library();Book book1 = new Book("Java Programming", "John Doe");Book book2 = new Book("Python Crash Course", "Jane Smith");library.addBook(book1);library.addBook(book2);System.out.println("所有图书信息:");library.displayAllBooks();Book foundBook = library.findBook("Java Programming");if (foundBook != null) {System.out.println("找到图书:Title: " + foundBook.getTitle() + ", Author: " + foundBook.getAuthor());} else {System.out.println("未找到该图书。");}System.out.println("\n移除找到的书籍");library.removeBook(foundBook);System.out.println("\n移除图书后所有图书信息:");library.displayAllBooks();}
}

难度题目

在线商城订单管理系统

功能描述

此在线商城订单管理系统是一个较为复杂的面向对象程序,用于模拟在线商城的订单管理流程,包含了商品、用户、购物车、订单等核心概念。以下是各个类的详细功能:

1. Product 
  • 属性
    • productId:商品的唯一标识符,类型为 String
    • name:商品的名称,类型为 String
    • price:商品的单价,类型为 double
    • stock:商品的库存数量,类型为 int
  • 方法
    • 构造方法:用于初始化商品的基本信息。
    • getProductId():获取商品的唯一标识符。
    • getName():获取商品的名称。
    • getPrice():获取商品的单价。
    • getStock():获取商品的库存数量。
    • decreaseStock(int quantity):减少商品的库存数量,当减少的数量大于当前库存时,抛出异常。
    • increaseStock(int quantity):增加商品的库存数量。
2. User 
  • 属性
    • userId:用户的唯一标识符,类型为 String
    • name:用户的姓名,类型为 String
    • shoppingCart:用户的购物车,类型为 ShoppingCart
    • orders:用户的订单列表,类型为 List<Order>
  • 方法
    • 构造方法:用于初始化用户的基本信息,并创建一个空的购物车和订单列表。
    • getUserId():获取用户的唯一标识符。
    • getName():获取用户的姓名。
    • getShoppingCart():获取用户的购物车。
    • getOrders():获取用户的订单列表。
    • addOrder(Order order):将一个新的订单添加到用户的订单列表中。
3. ShoppingCart 
  • 属性
    • items:购物车中的商品项列表,类型为 List<CartItem>
  • 方法
    • 构造方法:用于创建一个空的购物车。
    • addItem(Product product, int quantity):向购物车中添加一个商品项,如果商品已存在,则增加其数量;如果商品不存在,则创建一个新的商品项。
    • removeItem(Product product):从购物车中移除指定的商品项。
    • updateQuantity(Product product, int newQuantity):更新购物车中指定商品项的数量。
    • getTotalPrice():计算购物车中所有商品项的总价。
    • clear():清空购物车中的所有商品项。
4. CartItem 
  • 属性
    • product:购物车中的商品,类型为 Product
    • quantity:商品的数量,类型为 int
  • 方法
    • 构造方法:用于初始化购物车中的商品项。
    • getProduct():获取购物车中的商品。
    • getQuantity():获取商品的数量。
    • getTotalPrice():计算该商品项的总价。
5. Order 
  • 属性
    • orderId:订单的唯一标识符,类型为 String
    • user:下单的用户,类型为 User
    • items:订单中的商品项列表,类型为 List<CartItem>
    • orderStatus:订单的状态,类型为 String(如 "待支付"、"已支付"、"已发货" 等)。
  • 方法
    • 构造方法:用于初始化订单的基本信息。
    • getOrderId():获取订单的唯一标识符。
    • getUser():获取下单的用户。
    • getItems():获取订单中的商品项列表。
    • getOrderStatus():获取订单的状态。
    • setOrderStatus(String status):设置订单的状态。
    • getTotalPrice():计算订单中所有商品项的总价。
6. OnlineMall 
  • 属性
    • products:商城中的商品列表,类型为 List<Product>
    • users:商城的用户列表,类型为 List<User>
  • 方法
    • 构造方法:用于创建一个空的商城,包含空的商品列表和用户列表。
    • addProduct(Product product):向商城中添加一个新的商品。
    • addUser(User user):向商城中添加一个新的用户。
    • processOrder(User user):处理用户的订单,包括创建订单、减少商品库存、清空购物车等操作。

测试数据描述
  • 商品数据
    • 笔记本电脑:商品编号 "P001",名称 "笔记本电脑",单价 5000 元,库存 10 件。
    • 手机:商品编号 "P002",名称 "手机",单价 3000 元,库存 20 件。
  • 用户数据
    • 用户 "张三":用户编号 "U001"
  • 购物车数据
    • 用户 "张三" 的购物车中添加 1 台笔记本电脑和 2 部手机。
  • 预期结果
    • 生成一个新的订单,订单编号为以 "O" 开头并包含当前时间戳的字符串。
    • 订单总价为 1 * 5000 + 2 * 3000 = 11000 元。
    • 订单状态初始为 "待支付"
    • 笔记本电脑的库存减少为 9 件,手机的库存减少为 18 件。
    • 用户 "张三" 的购物车被清空。

Product类

public class Product {private String productId;private String name;private double price;private int stock;public Product(String productId, String name, double price, int stock) {this.productId = productId;this.name = name;this.price = price;this.stock = stock;}public String getProductId() {return productId;}public String getName() {return name;}public double getPrice() {return price;}public int getStock() {return stock;}public void decreaseStock(int quantity) {if (quantity > stock) {throw new IllegalArgumentException("库存不足");}stock -= quantity;}public void increaseStock(int quantity) {stock += quantity;}
}

User类

import java.util.ArrayList;
import java.util.List;public class User {private String userId;private String name;private ShoppingCart shoppingCart;private List<Order> orders;public User(String userId, String name) {this.userId = userId;this.name = name;this.shoppingCart = new ShoppingCart();this.orders = new ArrayList<>();}public String getUserId() {return userId;}public String getName() {return name;}public ShoppingCart getShoppingCart() {return shoppingCart;}public List<Order> getOrders() {return orders;}public void addOrder(Order order) {orders.add(order);}
}

ShoppingCart类

import java.util.ArrayList;
import java.util.List;public class ShoppingCart {private List<CartItem> items;public ShoppingCart() {this.items = new ArrayList<>();}public void addItem(Product product, int quantity) {for (CartItem item : items) {if (item.getProduct().getProductId().equals(product.getProductId())) {item.setQuantity(item.getQuantity() + quantity);return;}}items.add(new CartItem(product, quantity));}public void removeItem(Product product) {items.removeIf(item -> item.getProduct().getProductId().equals(product.getProductId()));}public void updateQuantity(Product product, int newQuantity) {for (CartItem item : items) {if (item.getProduct().getProductId().equals(product.getProductId())) {item.setQuantity(newQuantity);return;}}}public double getTotalPrice() {double total = 0;for (CartItem item : items) {total += item.getTotalPrice();}return total;}public void clear() {items.clear();}public List<CartItem> getItems() {return items;}
}

CartItem类

public class CartItem {private Product product;private int quantity;public CartItem(Product product, int quantity) {this.product=product;this.quantity=quantity;}public Product getProduct() {return product;}public int getQuantity() {return quantity;}public void setQuantity(int quantity) {this.quantity=quantity;}public double getTotalPrice() {return product.getPrice() * quantity;}
}

Order类

public class Order {private String orderId;private User user;private List<CartItem> items;private String orderStatus;public Order(String orderId, User user, List<CartItem> items, String orderStatus) {this.orderId = orderId;this.user = user;this.items = items;this.orderStatus = orderStatus;}public String getOrderId() {return orderId;}public User getUser() {return user;}public List<CartItem> getItems() {return items;}public String getOrderStatus() {return orderStatus;}public void setOrderStatus(String status) {this.orderStatus = status;}public double getTotalPrice() {double total = 0;for (CartItem item : items) {total += item.getTotalPrice();}return total;}
}

OnlineMall类

import java.util.ArrayList;
import java.util.List;public class OnlineMall {private List<Product> products;private List<User> users;public OnlineMall() {this.products = new ArrayList<>();this.users = new ArrayList<>();}public void addProduct(Product product) {products.add(product);}public void addUser(User user) {users.add(user);}public void processOrder(User user) throws Exception {ShoppingCart cart = user.getShoppingCart();List<CartItem> items = new ArrayList<>(cart.getItems());for (CartItem item : items) {Product product = item.getProduct();product.decreaseStock(item.getQuantity());}String orderId = "O" + System.currentTimeMillis();Order order = new Order(orderId, user, items, "待支付");user.addOrder(order);cart.clear();}
}

Test类

public class test {public static void main(String[] args) throws Exception {OnlineMall mall = new OnlineMall();Product laptop = new Product("P001", "笔记本电脑", 5000, 10);Product phone = new Product("P002", "手机", 3000, 20);mall.addProduct(laptop);mall.addProduct(phone);User zhangsan = new User("U001", "张三");mall.addUser(zhangsan);ShoppingCart cart = zhangsan.getShoppingCart();cart.addItem(laptop, 1);cart.addItem(phone, 2);mall.processOrder(zhangsan);System.out.println("订单编号: " + zhangsan.getOrders().get(0).getOrderId());System.out.println("订单总价: " + zhangsan.getOrders().get(0).getTotalPrice());System.out.println("订单状态: " + zhangsan.getOrders().get(0).getOrderStatus());System.out.println("笔记本电脑库存: " + laptop.getStock());System.out.println("手机库存: " + phone.getStock());System.out.println("购物车是否为空: " + zhangsan.getShoppingCart().getItems().isEmpty());}
}

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

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

相关文章

楼宇自控系统如何为现代建筑打造安全、舒适、节能方案

在科技飞速发展的当下&#xff0c;现代建筑对功能和品质的要求日益提升。楼宇自控系统作为建筑智能化的核心技术&#xff0c;宛如一位智慧的“管家”&#xff0c;凭借先进的技术手段&#xff0c;为现代建筑精心打造安全、舒适、节能的全方位解决方案&#xff0c;让建筑真正成为…

绿算轻舟系列FPGA加速卡:驱动数字化转型的核心动力【2】

工业与医疗&#xff1a;精准化的幕后推手 在工业4.0与智慧医疗领域&#xff0c;绿算轻舟FPGA加速卡通过实时信号处理与高精度控制&#xff0c;推动关键场景的技术升级。 工业自动化&#xff1a;在机器视觉质检中&#xff0c;实现亚像素级缺陷检测&#xff0c;产线检测速度大幅…

uniapp-商城-22-顶部模块

这里其实很复杂.我们在前面已经说了这个组件 shop-headbar ,这里来继续说。 该组件实现一个高度的显示以及图片展示,包含logo 名称 后台管理以及避让 导航栏 和 手机的状态栏。 1 整体 代码如下: <template><view class="headr" :style="{ hei…

利用Global.asax在ASP.NET Web应用中实现功能

Global.asax文件&#xff08;也称为ASP.NET应用程序文件&#xff09;是ASP.NET Web应用程序中的一个重要文件&#xff0c;它允许您处理应用程序级别和会话级别的事件。下面介绍如何利用Global.asax来实现各种功能。 Global.asax基本结构 <% Application Language"C#&…

ReportLab 导出 PDF(页面布局)

ReportLab 导出 PDF&#xff08;文档创建&#xff09; ReportLab 导出 PDF&#xff08;页面布局&#xff09; ReportLab 导出 PDF&#xff08;图文表格) PLATYPUS - 页面布局和排版 1. 设计目标2. 开始3. Flowables3.1. Flowable.draw()3.2. Flowable.drawOn(canvas,x,y)3.3. F…

Ubuntu下安装Intel MKL完整指南

&#x1f9e0; Intel MKL 安装指南&#xff08;Ubuntu 完整版&#xff09; 适用平台&#xff1a;Ubuntu 18.04 / 20.04 / 22.04 更新时间&#xff1a;2025 年最新版&#xff08;适配 Intel oneAPI 2024&#xff09; ✅ 一、安装方式选择 安装方式适合用户群体特点推荐程度&…

HackMyVM Gigachad.

Gigachad 信息搜集 ┌──(root㉿kali)-[/home/kali] └─# nmap 192.168.214.85 Starting Nmap 7.95 ( https://nmap.org ) at 2025-04-16 07:42 EDT Nmap scan report for 192.168.214.85 Host is up (0.00011s latency). Not shown: 997 closed tcp ports (reset) PORT S…

大模型全景解析:从技术突破到行业变革

目录 一、引言&#xff1a;人工智能的新纪元 二、大模型发展历史与技术演进 1. 早期探索期&#xff08;2015-2017&#xff09;&#xff1a;从"人工智障"到初具规模 RNN/LSTM架构时代&#xff08;2013-2017&#xff09; Transformer革命&#xff08;2017&#xf…

49、Spring Boot 详细讲义(六)(SpringBoot2.x整合Mybatis实现CURD操作和分页查询详细项目文档)

项目文档:银行借据信息CURD操作和分页查询 一、项目概述 1. 项目简介 本项目旨在使用Spring Boot框架整合MyBatis连接Mysql数据库实现借据信息的增加、删除、修改和查询功能,同时支持分页查询,并提供对应的Restful风格的接口。 2.环境准备 2.1.工具和软件准备 JDK(建议…

youtube视频和telegram视频加载原理差异分析

1. 客户侧缓存与流式播放机制​​ 流式视频应用&#xff08;如 Netflix、YouTube&#xff09;通过​​边下载边播放​​实现流畅体验&#xff0c;其核心依赖以下技术&#xff1a; ​​缓存预加载​​&#xff1a;客户端在后台持续下载视频片段&#xff08;如 DASH/HLS 协议的…

把城市变成智能生命体,智慧城市的神奇进化

智能交通系统的建立与优化 智能交通系统&#xff08;ITS&#xff09;是智慧城市建设的核心部分之一&#xff0c;旨在提升交通管理效率和安全性。该系统利用传感器网络、GPS定位技术以及实时数据分析来监控和管理城市中的所有交通流动。例如&#xff0c;通过部署于道路两侧或交…

Oracle 23ai Vector Search 系列之5 向量索引(Vector Indexes)

文章目录 Oracle 23ai Vector Search 系列之5 向量索引Oracle 23ai支持的向量索引类型内存中的邻居图向量索引 (In-Memory Neighbor Graph Vector Index)磁盘上的邻居分区矢量索引 (Neighbor Partition Vector Index) 创建向量索引HNSW索引IVF索引 向量索引示例参考 Windows 环…

cas 5.3单点登录中心开发手册

文档格式PDF 只读文档。 代码源码。 一、适用对象 需要快速上手出成果的服务端开发人员&#xff0c;具备3年经验java 开发&#xff0c;熟悉数据库&#xff0c;基本的Linux操作系统配置。 工期紧张需要快速搭建以cas为基础的统一登录中心&#xff0c;遇到技术瓶颈&#xff0c…

行星际激波在日球层中的传播:Propagation of Interplanetary Shocks in the Heliosphere (第一部分)

行星际激波在日球层中的传播&#xff1a;Propagation of Interplanetary Shocks in the Heliosphere &#xff08;第二部分&#xff09;- Chapter 3: Solar and heliospheric physics 行星际激波在日球层中的传播&#xff1a;Propagation of Interplanetary Shocks in the Hel…

Linux——消息队列

目录 一、消息队列的定义 二、相关函数 2.1 msgget 函数 2.2 msgsnd 函数 2.3 msgrcv 函数 2.4 msgctl 函数 三、消息队列的操作 3.1 创建消息队列 3.2 获取消息队列并发送消息 3.3 从消息队列接收消息recv 四、 删除消息队列 4.1 ipcrm 4.2 msgctl函数 一、消息…

蓝桥杯常考排序

1.逆序 Collections.reverseOrder() 方法对列表进行逆序排序。通过 Collections.sort() 方法配合 Collections.reverseOrder()&#xff0c;可以轻松实现从大到小的排序。 import java.util.ArrayList; // 导入 ArrayList 类&#xff0c;用于创建动态数组 import java.util.C…

ILGPU的核心功能使用详解

什么是ILGPU? ILGPU 是一种用于高性能 GPU 程序的新型 JIT&#xff08;即时&#xff09;编译器 &#xff08;也称为 kernels&#xff09;编写的 .基于 Net 的语言。ILGPU 完全 用 C# 编写&#xff0c;没有任何原生依赖项&#xff0c;允许您编写 GPU 真正可移植的程序。…

金融的未来

1. DeFi的爆发式增长与核心使命 DeFi&#xff08;去中心化金融&#xff09;的使命是重构传统金融基础设施&#xff0c;通过区块链技术实现更高的透明度、可访问性、效率、便利性和互操作性。其增长数据印证了这一趋势&#xff1a; TVL&#xff08;总锁定价值&#xff09;爆炸…

在Vue项目中查询所有版本号为 1.1.9 的依赖包名 的具体方法,支持 npm/yarn/pnpm 等主流工具

以下是 在Vue项目中查询所有版本号为 1.1.9 的依赖包名 的具体方法&#xff0c;支持 npm/yarn/pnpm 等主流工具&#xff1a; 一、使用 npm 1. 直接过滤依赖树 npm ls --depth0 | grep "1.1.9"说明&#xff1a; npm ls --depth0&#xff1a;仅显示直接依赖&#xf…

其利天下即将亮相第21届(顺德)家电电源与智能控制技术研讨会

2025年4月25日&#xff0c;第21届&#xff08;顺德&#xff09;家电电源与智能控制技术研讨会即将拉开帷幕&#xff0c;其利天下应大比特之邀&#xff0c;确认将参加此次研讨会。 本次研讨会&#xff0c;我司委派研发总监冯建武先生围绕《重新定义风扇驱动&#xff1a;一套算法…