有关Java中的集合(1):List<T>和Set<T>

学习目标

  1. 核心掌握List集合
  2. 了解Set集合

1.List<T>

● java.util.List。有序列表。
● List集合元素的特点:有序表示存取有序(因为有索引)而且可以重复
● List常用实现类: ArrayList、LinkedList、Vector等

1.1 常用方法

在这里插入图片描述

1.2 使用方法

  • 测试List集合的使用方法
private static void demo1() {
    List<Integer> numList = new ArrayList<>();
    //1.新增
    numList.add(100);
    numList.add(20);
    numList.add(10);
    numList.add(2);

    //2.删除
    numList.remove(Integer.valueOf(20));//删除元素:20
    numList.removeIf(new Predicate<Integer>() {
            @Override
            public boolean test(Integer num) {
                return Integer.valueOf(20).equals(num);
            }
        });
    numList.removeIf(Integer.valueOf(20)::equals);
    //numList.clear();

    //3.修改
    Integer num = numList.set(0, 200);
    System.out.println("num:"+num);

    //4.查询
    Integer num = numList.get(0);
    System.out.println(num);

    //5.其它方法
    System.out.println(numList.size());
    System.out.println(numList.contains(100));
    System.out.println(numList.indexOf(20));//获得指定数据第一次出现的索引位置  -1
    System.out.println(numList.lastIndexOf(20));
    System.out.println(numList.isEmpty());

    numList.sort();//对集合数据进行排序  default void sort(Comparator<? super E> c);
    numList.sort(Comparator.naturalOrder());//对于Integer而言 其实底层已经提供了排序规则
     //List集合元素类型已经实现过Comparable接口的话,使用List.sort()建议这样写
    numList.sort(Comparator.reverseOrder());
  
    System.out.println(numList);
    numList.replaceAll(new UnaryOperator<Integer>() {//修改满足条件的多个数据
            @Override
            public Integer apply(Integer integer) {
                if (integer != null) {
                    if (integer >= 100) {
                        integer = 1;
                    }
                }
                return integer;
            }
        });
        

    /* numList.replaceAll(integer->{
            if (integer != null) {
                if (integer >= 100) {
                    integer = 1;
                }
            }
            return integer;
        });*/
}
  • 了解subList方法
private static void demo3() {

    List<String> list = new ArrayList<>();
    Collections.addAll(list, "a", "b", "c", "abc", "ccc");
    //List<T> subList(startIndex,endIndex);
    List<String> subList = list.subList(0, 3);

    //subList之后,对截取之后的集合对象执行更新操作,都会还原到原对象。
    //截取的集合对象: 记着原集合对象的 root
    //subList.add("hello");
    //subList.remove(0);
    //subList.set(0,"aaaa");

    //截取之后,操作原集合(新增/遍历截取集合/删除/修改)。会出现ConcurrentModificationException。
    list.remove(0);// 已经删除。modCount  触发的fail-fast

    System.out.println("subList:" + subList);
    System.out.println("list:" + list);

    //Arrays.asList();//数组转集合
    List<String> stringList = Arrays.asList("a", "b", "c", "abc", "ccc");
        stringList.add("hello");
        System.out.println(stringList);
}

1.3 遍历集合

private static void demo2() {
    //方便创建对象并添加多个集合数据  还要满足后期更新。操作集合的工具类  java.util.Collections
    List<String> list = new ArrayList<>();
    Collections.addAll(list, "a", "b", "c", "abc", "ccc");
    //遍历List集合-----> 任意一种方式都可以
    //1.增强for
    for (String s : list) {
            System.out.println(s);
        }

    //2.迭代器/listIterator
    Iterator<String> it = list.iterator();
        while (it.hasNext()) {
            String s = it.next();
            System.out.println(s);
        }
    /*ListIterator<String> listIterator = list.listIterator();
        while (listIterator.hasNext()) {
            String s = listIterator.next();
            System.out.println(s);
        }
        System.out.println("-----------------");
        //光标默认在最左端
        while (listIterator.hasPrevious()) {
            String s = listIterator.previous();
            System.out.println("s:"+s);
        }*/

    //3.普通for
    int size = list.size();
        for (int index = 0; index < size; index++) {
            System.out.println(list.get(index));
        }


    //4.forEach
    list.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });

    list.forEach(System.out::println);
    System.out.println(list);

}

1.4 常用实现类

● 有序的特点: (有2种解释)
● 1.有索引位置(新增的元素顺序与遍历时候的顺序一致的)
● 2.可以按照排序规则排序(升序/降序)

● 常见数据结构:
● 1. 数组
● 2. 链表:
1.单向链表: 当前数据/元素/节点 下一个节点的引用。
2.双向链表: 上一个节点的引用 当前数据 下一个节点的引用。
● 3. 红黑树
● 4. hash表

实现类底层数据结构性能/效率线程安全
ArrayList动态数组查询/修改效率高。新增/删除效率低不安全
LinkedList双向链表查询/修改效率低。新增/删除效率高。不安全
Vector动态数组单线程里面, 功能等价于ArrayList。并发,所有的功能性能偏低安全

● ArrayList底层是数组。 因为数组内存空间连续所以查询性能较高(时间复杂度 O(1) ),删除元素和指定位置新增涉及到数组元素的移动 所以性能较低
● LinkedList底层是双向链表 内存空间不连续;链表的查询性能较低(要么从头查 要么从尾部查询 O(n)),删除和新增性能较高(只需要改动前后2个节点)

1.4.1 ArrayList<T>

● 创建集合对象的时候 使用泛型进行约束
● 底层是数组 ,当调用无参构造的时候,内部数组第一次扩容长度为10;当调用有参构造的时候 直接new一个指定长度的数组(建议使用有参构造 给一个大概的容量值 避免内部多次扩容降低性能)
● 底层是数组 因为数组内存空间连续所以查询性能较高,删除元素和指定位置新增涉及到数组元素的移动 所以性能较低

1.层级

public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, Serializable{}
//RandomAccess: 快速随机访问。 空接口,标记接口。使用index遍历集合数据比迭代器效率快很多的。

2.常用构造

1. ArrayList() ;// 创建ArrayList集合对象  并初始化容量为10.---->数组的length。
2. ArrayList(int initialCapacity);//指定初始化容量数据   推荐。10
     //initialCapacity: 存储的最大元素个数/负载因子+1;
3. ArrayList(Collection<? extends E> c);//将一个集合的数据转换成ArrayList

3.基本使用

/**

  • 泛型 元素类型 加约束
    */
    public static void arrayListMethod() {
    ArrayList arrayList = new ArrayList();
    arrayList.add(“abc”);
    arrayList.add(“123”);
    // 加了泛型之后 取出来的元素 直接就是String类型了
    String str = arrayList.get(1);
    // 集合中都是对象 没有基本数据类型
    ArrayList arrayList2 = new ArrayList<>();
    arrayList2.add(123);
    }

1.4.2 LinkedList<T>

● 底层是链表 双向链表 内存空间不连续
● 链表的查询性能较低,删除和新增性能较高(新增与删除最多只需要改动前后2个节点)

1.层级

public class LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, Serializable{}
// 双链表实现了List和Deque接口。 实现所有可选列表操作,并允许所有元素(包括null )

2.常用构造

 1.LinkedList();//推荐使用
 2.LinkedList(Collection<? extends E> c) 

3.基本使用

private static void demo1() {
        LinkedList<String> linkedList = new LinkedList<>();
        //1.新增
        /*linkedList.add("a");
        linkedList.add(1,"b");
        linkedList.addFirst("hello");
        linkedList.addLast("abc");
        linkedList.push("111");*///addFirst  add(0,"111");
        linkedList.add("a");
        linkedList.add("b");
        linkedList.add("c");
        linkedList.add("d");
        linkedList.offer("1");//add();
        linkedList.offerFirst("0");
        linkedList.offerLast("100");

        //2.删除
        linkedList.remove("a");
        linkedList.remove(0);
       
        //删除第一个数据
        linkedList.removeFirst();
  

        //删除最后一个数据
        linkedList.remove(linkedList.size() - 1);
        linkedList.removeLast();
        linkedList.pollLast();

        //3.修改
        linkedList.set(0,"abc");

        //4.查询
        system.out.println(linkedList.get(0));
        System.out.println(linkedList.getFirst());
        System.out.println(linkedList.element());
        System.out.println(linkedList.peek());
        System.out.println(linkedList.peekFirst());

        /*System.out.println(linkedList.get(linkedList.size() - 1));
        System.out.println(linkedList.getLast());
        System.out.println(linkedList.peekLast());*/

        System.out.println(linkedList);

    }

1.4.3 Vector<T>

● 底层也是数组,是一个线程安全的集合类.
● 线程安全的ArrayList的变体。
● 根本原因: Vector中所有的方法都使用synchronized。
● 了解此类即可。

1.层级

public class Vector<E>
extends AbstractList<E>
implements List<E>, RandomAccess, Cloneable, Serializable{}

2.常用构造

1. Vector();//初始化容量为10
2. Vector(int initialCapacity) ;//建议使用

3.线程安全

public class VectorDemo {

    //private static Vector<Integer> list = new Vector<>(100);

    private static List<Integer> list = Collections.synchronizedList(new ArrayList<>(100));

    //需要将线程不安全的集合对象 转换成线程安全的集合对象  Collections.syn
    public static void main(String[] args) {
        demo2();
    }

    private static void demo2() {
        //开启多个任务 多个线程 同时操作list对象 新增数据
        //模拟: 创建10个线程  每个线程执行100次 add 1-100 1000个数据
        List<Thread> threadList = new ArrayList<>(10);
        for (int i = 0; i < 10; i++) {
            threadList.add(new Thread(VectorDemo::forDemo));
        }
        threadList.forEach(Thread::start);//启动10个线程

        //必须等待前10个线程的死亡
        try {
            for (Thread thread : threadList) {
                thread.join();
            }
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        System.out.println("size:" + list.size());//1000
    }

    private static void forDemo() {
        for (int num = 1; num <= 100; num++) {
            list.add(num);
        }
    }
}

2.Set<T>

● 实现了Set接口的实现类的集合元素数据: 无序 且不可重复
● 实现类有:HashSet ,LinkedHashSet, TreeSet等
● Set集合的每个数据都是作为Map的key来维护的。

2.1 常用方法

在Set集合中,没有独有的方法。所有的方法都是继承的Collection父接口。

2.2 使用方法

private static void demo1() {

        Set<Integer> set = new HashSet<>();//唯一 无序
        set.add(10);
        set.add(20);
        set.add(null);
       

        //删除
        //set.remove(10);
        //.....
        System.out.println(set);
        System.out.println(set.size());

    }

2.3 遍历集合

/**
     * Set 遍历方式有3种 因为没有索引 所以不能使用普通for循环
     */
    public static void demo2() {
        HashSet<String> hashSet = new HashSet<>();
        hashSet.add("aa");
        hashSet.add("bb");
        hashSet.add("cc");
        System.out.println("-----1---------");
        for (String str : hashSet) {
            System.out.println(str);
        }
        System.out.println("------2---------");
        Iterator<String> iterator = hashSet.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
        System.out.println("--------3----------");
        hashSet.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });
        hashSet.forEach((a) -> {
            System.out.println(a);
        });

        hashSet.forEach(System.out::println);
    }

2.4 常用实现类

数据结构元素是否可以为null线程安全
HashSethash表+位桶(数组)+单向链表+红黑树。(HashMap维护HashSet的数据)可以不安全
LinkedHashSet双向链表+hash表。(LinkedHashMap)可以不安全
TreeSet红黑树(TreeMap) 有序(自然顺序排列)平衡不可以不安全

2.4.1 HashSet<T>

1.常用构造

1.HashSet() //HashMap实例具有默认初始容量(16)和负载因子(0.75)。 
2.HashSet(int initialCapacity)    //  initialCapacity = 存储的最大的元素个数/负载因子+1

2.基本使用

private static void demo1() {

    HashSet<Integer> hashSet = new HashSet<>();
    //hashSet.add(1);
    Collections.addAll(hashSet, 1, 10, 8, 100, 2, 80);
    hashSet.add(100);
    hashSet.add(null);
    //元素是完全没有顺序  新增顺序与遍历顺序不一样
    //元素没有索引位置

    System.out.println(hashSet);
}

2.4.2 LinkedHashSet<T>

  • LinkedHashSet是HashSet的子类。
private static void demo2() {
    LinkedHashSet<Integer> linkedHashSet = new LinkedHashSet<>();
    Collections.addAll(linkedHashSet, 1, 10, 8, 100, 2, 80,null,80);
    System.out.println(linkedHashSet);

    //新增的顺序与遍历的顺序一致的
}

2.4.3 TreeSet<T>

1.常用构造

元素是有序(顺序)----> 按照自然顺序排列(排序)---->升序/降序
要求TreeSet集合的元素类型必须提供“排序规则”。
元素不能存储null(不能调用方法hashcode)
1. TreeSet() //根据其元素的自然排序进行排序. 要求集合元素类型必须实现java.lang.Comparable
2. TreeSet(Comparator<? super E> comparator) //自定义外部比较器对象 对集合元素进行排序

2.基本使用

private static void demo3() {
    TreeSet<Integer> treeSet = new TreeSet<>();//会集合元素排序---->集合元素类型的排序规则---> Integer
    //前提是无参构造  默认按照升序进行排列
    //treeSet.add(null);
    treeSet.add(10);
    treeSet.add(1);
    treeSet.add(0);
    treeSet.add(15);
    treeSet.add(12);
    System.out.println(treeSet);
    System.out.println("min:" + treeSet.first());
    System.out.println("max:" + treeSet.last());
}

3.集合存储对象

● 需求: 使用集合存储多个用户信息。

3.1 List<T>

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString    
public class UserInfo {

    private Integer id;
    private String name;
    private Integer age;
}
 private static void demo1() {
    //创建多个用户对象 存储到集合中
    //ArrayList
    //List集合可以存储多个重复的数据
    List<UserInfo> userInfoList = new ArrayList<>(10);
    userInfoList.add(new UserInfo(1, "张三", 20));
    userInfoList.add(new UserInfo(1, "张三", 20));
    userInfoList.add(new UserInfo(1, "张三", 20));
    userInfoList.add(new UserInfo(1, "张三", 20));
    userInfoList.forEach(System.out::println);
}

3.2 HashSet<T>

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString  
public class UserInfo  {

    private Integer id;
    private String name;
    private Integer age;

    //重写hashcode+equals  定义2分对象相等的规则
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UserInfo userInfo = (UserInfo) o;
        return
                Objects.equals(name, userInfo.name)
                ;
    }
    @Override
    public int hashCode() {
        return Objects.hash( name);
    }
    //......
}
private static void demo2() {
    //使用HashSet存储多个用户对象
    //无序且唯一的
    //使用Set存储自定义类型对象的时候  一定自己重写equals+hashcode  底层数据结构是重建hash
    //根据重写的equals+hashcode 判断对象是否是相同的对象
    Set<UserInfo> userInfoSet = new HashSet<>();
    userInfoSet.add(new UserInfo(1, "张三", 20));
    userInfoSet.add(new UserInfo(2, "张三", 20));
    userInfoSet.add(new UserInfo(3, "张三", 20));
    userInfoSet.add(new UserInfo(4, "张三", 20));
    userInfoSet.forEach(System.out::println);
}

3.3 TreeSet<T>

● TreeSet底层的数据结构是红黑树。
● 由于TreeSet集合的元素要按照排序规则进行排序。所以使用TreeSet集合存储自定义类对象,一定要提供排序规则。
● 可以根据不同的TreeSet构造创建对象:
● TreeSet(); 无参构造创建对象。要求集合元素类型必须实现Comparable接口。
● TreeSet(Comparator comparator); 有参构造创建对象。集合元素类型不必实现Comparable,这个时候会使用外部比较器Comparator里面定义的排序规则对集合元素排序。

  • 写法1:
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString  
public class UserInfo implements Comparable<UserInfo> {

    private Integer id;
    private String name;
    private Integer age;

    //自定义排序规则
    //不需要重写equals+hashcode  TreeSet底层不是hash维护的,与这2个方法没有一点关系,只看排序规则。
    //在排序规则里面,相关属性相同的对象就会认为是相同的对象。
    @Override
    public int compareTo(UserInfo userInfo) {
        return userInfo.age.compareTo(this.age);
    }
}
private static void demo3() {
    //使用TreeSet存储多个用户对象
    //元素会排序----->排序规则是什么?
    //使用TreeSet无参构造创建对象  要求集合元素类型必须实现java.lang.Comparable
    //TreeSet与hash没有关系  底层是树结构维护的 只看排序规则里面的属性的数据
    TreeSet<UserInfo> userInfoTreeSet = new TreeSet<>();
    userInfoTreeSet.add(new UserInfo(1, "张三", 20));
    userInfoTreeSet.add(new UserInfo(2, "张三", 20));
    userInfoTreeSet.add(new UserInfo(3, "张三", 12));
    userInfoTreeSet.add(new UserInfo(4, "张三", 25));

    userInfoTreeSet.forEach(System.out::println);
}
  • 写法2:
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString  
public class UserInfo  {

    private Integer id;
    private String name;
    private Integer age;
}
 private static void demo4() {
//        TreeSet<UserInfo> userInfoTreeSet = new TreeSet<>(new Comparator<UserInfo>(){
//            @Override
//            public int compare(UserInfo user1, UserInfo user2) {
//                return user1.getAge().compareTo(user2.getAge());
//            }
//        });
//        TreeSet<UserInfo> userInfoTreeSet = new TreeSet<>((user1,user2)->user1.getAge().compareTo(user2.getAge()));
        TreeSet<UserInfo> userInfoTreeSet = new TreeSet<>(Comparator.comparing(UserInfo::getAge));
        userInfoTreeSet.add(new UserInfo(1, "张三", 20));
        userInfoTreeSet.add(new UserInfo(2, "张三", 20));
        userInfoTreeSet.add(new UserInfo(3, "张三", 12));
        userInfoTreeSet.add(new UserInfo(4, "张三", 25));

        userInfoTreeSet.forEach(System.out::println);
    }
}

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

第J1周:ResNet50算法(Tensorflow版)

&#x1f368; 本文为&#x1f517;365天深度学习训练营 中的学习记录博客&#x1f356; 原作者&#xff1a;K同学啊 目标 具体实现 &#xff08;一&#xff09;环境 语言环境&#xff1a;Python 3.10 编 译 器: PyCharm 框 架: TensorFlow &#xff08;二&#xff09;具体…

第三百七十一节 JavaFX教程 - JavaFX组合框

JavaFX教程 - JavaFX组合框 组合框允许用户选择几个选项之一。用户可以滚动到下拉列表。组合框可以是可编辑和不可编辑的。 创建组合框 以下代码将选项列表包装到ObservableList中&#xff0c;然后使用observable列表实例化ComboBox类。 ObservableList<String> optio…

《HelloGitHub》第 107 期

兴趣是最好的老师&#xff0c;HelloGitHub 让你对编程感兴趣&#xff01; 简介 HelloGitHub 分享 GitHub 上有趣、入门级的开源项目。 github.com/521xueweihan/HelloGitHub 这里有实战项目、入门教程、黑科技、开源书籍、大厂开源项目等&#xff0c;涵盖多种编程语言 Python、…

和鲸科技推出人工智能通识课程解决方案,助力AI人才培养

2025年2月&#xff0c;教育部副部长吴岩应港澳特区政府邀请&#xff0c;率团赴港澳宣讲《教育强国建设规划纲要 (2024—2035 年)》。在港澳期间&#xff0c;吴岩阐释了教育强国目标的任务&#xff0c;并与特区政府官员交流推进人工智能人才培养的办法。这一系列行动体现出人工智…

2025 最新版鸿蒙 HarmonyOS 开发工具安装使用指南

为保证 DevEco Studio 正常运行&#xff0c;建议电脑配置满足如下要求&#xff1a; Windows 系统 操作系统&#xff1a;Windows10 64 位、Windows11 64 位内存&#xff1a;16GB 及以上硬盘&#xff1a;100GB 及以上分辨率&#xff1a;1280*800 像素及以上 macOS 系统 操作系统…

not support ClassForName

com.alibaba.fastjson2.JSONException: not support ClassForName : java.lang.String, you can config JSONReader.Feature.SupportClassForName 官方说明中提到默认关闭&#xff0c; 可通过配置开启 JSON.config(JSONReader.Feature.SupportClassForName);

面试常问的压力测试问题

性能测试作为软件开发中的关键环节&#xff0c;确保系统在高负载下仍能高效运行。压力测试作为性能测试的重要类型&#xff0c;旨在通过施加超出正常负载的压力&#xff0c;观察系统在极端条件下的表现。面试中&#xff0c;相关问题常被问及&#xff0c;包括定义、重要性、与负…

《白帽子讲 Web 安全》之移动 Web 安全

目录 摘要 一、WebView 简介 二、WebView 对外暴露 WebView 对外暴露的接口风险 三、通用型 XSS - Universal XSS 介绍 四、WebView 跨域访问 五、与本地代码交互 js 5.1接口暴露风险&#xff1a; 5.2漏洞利用&#xff1a; 5.3JavaScript 与 Native 代码通信 六、Chr…

MySQL-基础篇学习总结(2025-03-02)

几个月前学习了MySQL,后来忙着准备毕业论文的事情&#xff0c;好几个月没有回顾&#xff0c;最近又开始看这块内容准备春招了&#xff0c;所以决定把学习过的东西做一下总结。 1. MySQL概述 这部分内容介绍数据库相关概念及MySQL数据库的介绍、下载、安装、启动及连接。具体的…

AUTOSAR简介

目录 核心目标 架构分层 核心优势 经典AUTOSAR vs 自适应AUTOSAR 典型应用场景 挑战与未来发展 相关企业介绍 1. 传统汽车电子供应商&#xff08;Tier1&#xff09; 2. 软件服务商与工具链企业 3. 新兴科技公司与自动驾驶企业 4. 基础软件与工具链企业 5. 高校与研…

vulnhub靶场之【digitalworld.local系列】的bravery靶机

前言 靶机&#xff1a;digitalworld.local-bravery&#xff0c;IP地址为192.168.10.8 攻击&#xff1a;kali&#xff0c;IP地址为192.168.10.6 kali采用VMware虚拟机&#xff0c;靶机采用virtualbox虚拟机&#xff0c;网卡都为桥接模式 这里官方给的有两种方式&#xff0c;…

探索AIGC的核心原理与应用前景

随着人工智能的迅猛发展&#xff0c;AIGC&#xff08;Artificial Intelligence Generated Content&#xff09;作为一个新兴领域&#xff0c;逐渐引起了广泛关注。它不仅重新定义了创作的方式&#xff0c;还为各行各业带来了诸多变革。本文将深入探讨AIGC的基本原理、技术框架以…

解码中国AI双雄突围:DeepSeek破壁与英伟达反攻背后的算力暗战

一、算力困局下的中国突围术 2024年夏季的科技界暗流涌动&#xff1a;北京中关村的服务器机房里&#xff0c;寒武纪最新MLU300X芯片正以每秒120万亿次运算支撑着自动驾驶系统的实时决策&#xff1b;上海张江的AI实验室中&#xff0c;DeepSeek团队通过神经元分块技术将模型参数压…

C++ Qt OpenGL渲染FFmpeg解码后的视频

本篇博客介绍使用OpenGL渲染FFmpeg解码后的视频,涉及到QOpenGLWidget、QOpenGLFunctions、OpenGL shader以及纹理相关,播放效果如下: 开发环境:Win11 C++ Qt6.8.1、FFmpeg4.0、x64   注意:Qt版本不同时,Qt OpenGL API及用法可能差别比较大,FFmpeg版本不同时API调用可能…

【Linux】进程退出 | 初始缓冲区 | 子进程回收(六)

目录 前言&#xff1a; 一、main函数的返回值 二、退出码有什么用&#xff1f; 三、perror/strerror/erron 四、erron变量 五、exit函数 六、_exit变量 七、初始缓冲区 八、wait函数和folk函数的返回值 九、父进程获取子进程退出信息waitpid函数 1.返回值 2.第一个…

【vscode-解决方案】vscode 无法登录远程服务器的两种解决办法

解决方案一&#xff1a; 查找原因 命令 ps ajx | grep vscode 可能会看到一下这堆信息&#xff08;如果没有大概率不是这个原因导致&#xff09; 这堆信息的含义&#xff1a;当你使用 vscode 远程登录服务器时&#xff0c;我们远程机器服务端要给你启动一个叫做 vscode serv…

制氧机分子筛的材质选择与解析‌

制氧机中的分子筛&#xff0c;是一种可以在分子水平上筛选物质的多孔材料。这种材料的主要成分是人工合成的晶体铝硅酸盐&#xff0c;也被称为沸石材料。 二、常用分子筛材质分析 1. 沸石分子筛 沸石分子筛是目前制氧机中最常用的材质之一。它具有以下显著优点&#xff1a; ‌吸…

如何把网络ip改为动态:全面指南

在数字化时代&#xff0c;网络IP地址作为设备在网络中的唯一标识&#xff0c;扮演着至关重要的角色。随着网络环境的不断变化&#xff0c;静态IP地址的局限性逐渐显现&#xff0c;而动态IP地址则因其灵活性和安全性受到越来越多用户的青睐。那么&#xff0c;如何把网络IP改为动…

如何在docker上部署java服务

目录结构 首先 Dockerfile FROM bladex/alpine-java:openjdk17_cn_slimMAINTAINER admin@rsz.comENV TZ=Asia/ShanghaiRUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezoneRUN mkdir -p /xhWORKDIR /xhEXPOSE 8106ADD ./blade-system.…

进行性核上性麻痹患者的生活护理指南

进行性核上性麻痹是一种神经系统退行性疾病&#xff0c;合理的生活护理能有效改善症状&#xff0c;提高生活质量。 居家环境要安全。移除地面杂物&#xff0c;铺设防滑垫&#xff0c;安装扶手&#xff0c;降低跌倒风险。在浴室、厨房等湿滑区域要特别加强防护措施。建议在床边、…