StreamAPI

news2024/10/7 0:27:47

StreamAPI

最近开发用上了 Java8的StreamAPI,(咋现在才用?嗯哼,项目需要)自己也不怎么会,来总结一波吧!

别认为好抽象!!!干他就完事
在这里插入图片描述

一.StreamAPI介绍

就是用来处理集合的数据 其实到后面会发现和SQL的语句是差不多的~哈哈?你不信?往下面看

Stream:英文翻译叫做流

举个粟子:Stream相当于一条河流,数据相当于里面的水,这条河流里面的水你要饮用还是其他操作叫做Stream的执行数据操作,从而达到你要的目的(比如达成饮用水的目的),在计算机中就是处理达成你要的结果

注意!

  1. Stream不会自己存储元素
  2. 不会改变源对象,只是返回含有结果的一个新Stream
  3. 延迟执行,在要结果的时候才执行(有点像懒汉模式)
    在这里插入图片描述

二.流操作的过程

主要就是从生到死周期

  1. 创建Stream:就是从一个数组或者集合拿取数据(相当于找到水源地)
//主要两种创建方式:
1.Steam()
2.parallelStream()   //这个主要返回并行流
    
//eg:
   List<String>  list=new ArrayList<>();
   Stream<String> s1=list.stream();//   
===========================================
//值创建流     Stream.of()   静态方法显示创建   
    Stream<String>  s=Stream.of("a","s","ddddd");
	s.forEach(System.out::println);
	
==============================================
//创建无限流   
    Stream.iterate()  和  Stream.generate()两个方法
    //举例  迭代
    Steam<Integer> s=Stream.iterate(0,(x)->x>>1);
	s.limit(10).forEach(System.out::println);
    //举例 生成
	Stream.generate(()->Math.random().limit(6)
                   forEach(System.out::println));
  1. **中间逻辑操作:**就相当于SQL语句中执行条件,处理达到你要的结果和业务数据(比如你要取水去做饮用水啊中间是不是要净化啥的操作)

看下面的主题,太多了,但也是重点

  1. **结束:**就是终止条件,写结果返回语句,不能无休止啊

三.中间操作

终止操作时才会一次性全部处理,就是要到开学了,小学生才会用功写完全部作业~哈哈

filter,limit,skip,distinct

1.筛选切片

Filter:接受Lambda,进行过滤操作,排除一些不需要的元素

// (1)filter——接收 Lambda , 从流中排除某些元素。
    @Test
    public void testFilter() {
        //这里加入了终止操作 ,不然中间操作一系列不会执行
        //中间操作只有在碰到终止操作才会执行
        emps.stream()
        .filter((e)->e.getAge()>18)  //过滤只要年龄大于18 的
        .forEach(System.out::println);//终止操作
        
    }

limit(n):截取指定n个以内数量的元素

// (2)limit——截断流,使其元素不超过给定数量。
    @Test
    public void testLimit() {
    emps.stream()
        .filter((e)->e.getAge()>8)
        .limit(6)//跟数据库中的limit有差不多
        .forEach(System.out::println);//终止操作

    }

skip(n):跳过元素,就是前n个元素不要,从第n+1个数开始,没有,就返回空

// (3)skip(n) —— 跳过元素,返回一个扔掉了前 n 个元素的流。若流中元素不足 n 个,则返回一个空流。与 limit(n) 互补
    @Test
    public void testSkip() {
    emps.stream()
        .filter((e)->e.getAge()>8)
        .skip(2)//这里可以查找filter过滤后的数据,前两个不要,要后面的,与limit相反
        .forEach(System.out::println);//终止操作
    }

distinct:就是去重,返回不重复的元素

原理:利用hashCode()equals()去除重复的元素,

// (4)distinct——筛选,通过流所生成元素的 hashCode() 和 equals() 去除重复元素
    @Test
    public void testDistinct() {
    emps.stream()
        .distinct()//去除重复的元素,因为通过流所生成元素的 hashCode() 和 equals() 去除重复元素,所以对象要重写hashCode跟equals方法
        .forEach(System.out::println);//终止操作
    }

2.Map映射

  • map()
  • mapToDouble()
  • mapToInt()
  • mapToLong()
  • flatMap()

map():就是接受一个函数作为参数,该参数会被应用到每个元素上,并且映射成一个新的元素

flatMap():接受一个函数作为参数,并且将流中每个值转换成另一个流,然后把所有的流连成一个流

直接复制了哈,这个代码感觉还是不错的,一起看看吧~哈哈

//  map-接收Lambda,将元素转换成其他形式或提取信息。接收一个函数作为参数,该函数会被应用到每个元素上,并将其映射成一个新的元素。
    @Test
    public void testMapAndflatMap() {
        List<String> list=Arrays.asList("aaa","bbb","ccc","ddd");
        list.stream()
        .map((str)->str.toUpperCase())//里面是Function
        .forEach(System.out::println);
        
        System.out.println("----------------------------------");
        //这里是只打印名字,map映射,根据Employee::getName返回一个name,映射成新的及结果name
        emps.stream()
        .map(Employee::getName)
        .forEach(System.out::println);
        
        System.out.println("======================================");
        
        //流中流
        Stream<Stream<Character>> stream = list.stream()
        .map(StreamAPI::filterCharacter);
        //{{a,a,a},{b,b,b}}
        //map是一个个流(这个流中有元素)加入流中
        
        stream.forEach(sm->{
            sm.forEach(System.out::println);
        });
        
        System.out.println("=============引进flatMap=============");
//      只有一个流
        Stream<Character> flatMap = list.stream()
        .flatMap(StreamAPI::filterCharacter);
        //flatMap是将一个个流中的元素加入流中
        //{a,a,a,b,b,b}
        flatMap.forEach(System.out::println);
        
    }
    /**
     * 测试map跟flatMap的区别
     * 有点跟集合中的add跟addAll方法类似    这个就好理解多了
     * add是将无论是元素还是集合,整体加到其中一个集合中去[1,2,3.[2,3]]
     * addAll是将无论是元素还是集合,都是将元素加到另一个集合中去。[1,2,3,2,3]
     * @param str
     * @return
     */
    public static Stream<Character> filterCharacter(String str){
        List<Character> list=new ArrayList<>();
        for (Character character : str.toCharArray()) {
            list.add(character);
        }
        return list.stream();
    }

3.排序

自然排序: sorted()

定制排序: sorted(Comparator c): 就是里面写你想添加判断条件

货不多说,看测试代码

@Test
    public  void  testSorted() {
        List<String> list=Arrays.asList("ccc","aaa","bbb","ddd","eee");
        list.stream()
        .sorted()
        .forEach(System.out::println);
        
        System.out.println("=======定制排序=========");
        //=====仔细瞅瞅这边
        emps.stream()
        .sorted((x, y) -> {
            if(x.getAge() == y.getAge()){
                return x.getName().compareTo(y.getName());
            }else{
                return Integer.compare(x.getAge(), y.getAge());
            }
        }).forEach(System.out::println);
    }

四.结束

1.查找与匹配

allMatch(): 检查是否匹配所有元素

anyMatch(): 检查是否至少匹配一个元素

noneMatch(): 是否没有匹配的所有元素

findFirst(): 返回第一个元素

findAny(): 返回当前流中的任意元素


count(): 返回流中的元素总数

max(),min(): 返回流中的最大最小值

forEach(): 就是迭代循环,贼常用的

**测试代码:**复制过来的,写的不好,可以留言哈!!!

    //3. 终止操作
    /*查找与匹配
        allMatch——检查是否匹配所有元素
        anyMatch——检查是否至少匹配一个元素
        noneMatch——检查是否没有匹配的元素
        findFirst——返回第一个元素
        findAny——返回当前流中的任意元素
        count——返回流中元素的总个数
        max——返回流中最大值
        min——返回流中最小值
     */
    @Test
    public void test() {
//      emps.stream():获取串行流
//      emps.parallelStream():获取并行流
        System.out.println("==========allMatch==============");
        boolean allMatch = emps.stream()
                               .allMatch((e)->e.getStatus().equals(Status.BUSY));
        System.out.println(allMatch);
        
        System.out.println("==========anyMatch==============");
        boolean anyMatch = emps.stream()
                               .anyMatch((e)->e.getAge()>10);
        System.out.println(anyMatch);
        
        System.out.println("==========noneMatch==============");
        boolean noneMatch = emps.stream()
                                .noneMatch((e)->e.getStatus().equals(Status.BUSY));
        System.out.println(noneMatch);
        
        
        System.out.println("==========findFirst==============");
        Optional<Employee2> findFirst = emps.stream()
                                            .sorted((e1, e2) -> Double.compare(e1.getSalary(), e2.getSalary()))//按照工资排序并输出第一个
                                            .findFirst();       
        System.out.println(findFirst);
        
        
        System.out.println("==========findAny==============");
        Optional<Employee2> findAny = emps.stream()
            .filter((e)->e.getStatus().equals(Status.BUSY))
            .findAny();
        System.out.println(findAny);
        
        System.out.println("==========count==============");
        long count = emps.stream()
            .count();
        System.out.println(count);
        
        
        System.out.println("==========max==============");
        Optional<Double> max = emps.stream()
            .map(Employee2::getSalary)
            .max(Double::compare);
        System.out.println(max);
        
        System.out.println("==========min==============");
        Optional<Employee2> min = emps.stream()
                                      .min((e1,e2)->Double.compare(e1.getSalary(), e2.getSalary()));
        System.out.println(min);
        
            
    }

2.归纳

reduce(T iden,BinaryOperator b):流中元素反复结合得到一个值,返回T

reduce(BinaryOperator b):流中元素反复结合得到一个值,返回Optional<T>

map-reduce模式感兴趣可以骚操作一波

@Test
    public void testReduce() {
        List<Integer> list= Arrays.asList(1,2,3,4,5,6,7,8,9,10);
        Integer sum = list.stream()
            .reduce(0,(x,y)->x+y);
        System.out.println(sum);
        
        Optional<Double> reduce = emps.stream()
            .map(Employee2::getSalary)
            .reduce(Double::sum);
        System.out.println(reduce.get());
        
    }

3.收集

collect():你想收集成啥样的集合返回

Collectors其中主要的方法:

方法名作用返回类型
toSet把流中元素收集到setSet
toList将流中的元素收集到ListList
toCollection:将流中的元素收集到自己创建的集合中Collection
counting计算流中的元素个数long
summingInt对元素中的整数类型求和Integer
averagingInt求平均值Double
summarizingInt收集流中Integer属性的统计值IntSummaryStatistics
方法作用返回类型
joining连接流中的每个字符串String
maxBy,minBy根据比较器选择最大最小值Optional
reducing归约归约产生的类型
collectingAndThen包裹另一个收集器并对其结果转换函数转换函数返回的类型
groupingBy根据某些属性值对流分组,属性为k,结果为vMap<K,List>
partitioningBy根据true或false进行分区Map<Boolean,List>

测试代码:

//===============
List<String> collect = emps.stream()
            .map(Employee2::getName)
            .collect(Collectors.toList());
        collect.forEach(System.out::println);
//=====================================================

        Set<String> collect2 = emps.stream()
            .map(Employee2::getName)
            .collect(Collectors.toSet());
        collect2.forEach(System.out::println);
//=======================================================
HashSet<String> collect3 = emps.stream()
            .map(Employee2::getName)
            .collect(Collectors.toCollection(HashSet::new));
        collect3.forEach(System.out::println);
//======================================================

        
Optional<Double> collect = emps.stream()
            .map(Employee2::getSalary)
            .collect(Collectors.maxBy(Double::compare));
        System.out.println(collect.get());
        
        
        
        Optional<Employee2> collect2 = emps.stream()
            .collect(Collectors.maxBy((e1, e2) -> Double.compare(e1.getSalary(), e2.getSalary())));
        System.out.println(collect2.get());
//=======================================================
Optional<Double> collect4 = emps.stream()
        .map(Employee2::getSalary)
        .collect(Collectors.minBy(Double::compare));
        System.out.println(collect4);
        
        
        Optional<Employee2> collect3 = emps.stream()
        .collect(Collectors.minBy((e1,e2)->Double.compare(e1.getSalary(),e2.getSalary())));
        System.out.println(collect3.get());
//====================================================
Double collect5 = emps.stream()
        .collect(Collectors.summingDouble(Employee2::getSalary));
    System.out.println(collect5);
//========================================================
Double collect6 = emps.stream()
    .collect(Collectors.averagingDouble((e)->e.getSalary()));
    
    Double collect7 = emps.stream()
    .collect(Collectors.averagingDouble(Employee2::getSalary));
    
    System.out.println("collect6:"+collect6);
    System.out.println("collect7:"+collect7);
//=======================================================
//总数
    Long collect8 = emps.stream()
                       .collect(Collectors.counting());
    System.out.println(collect8);
//====================================================
DoubleSummaryStatistics collect9 = emps.stream()
        .collect(Collectors.summarizingDouble(Employee2::getSalary));
    long count = collect9.getCount();
    double average = collect9.getAverage();
    double max = collect9.getMax();
    double min = collect9.getMin();
    double sum = collect9.getSum();
    System.out.println("count:"+count);
    System.out.println("average:"+average);
    System.out.println("max:"+max);
    System.out.println("min:"+min);
    System.out.println("sum:"+sum);
//=========================================================
//分组
    @Test
    public void testCollect3() {
        Map<Status, List<Employee2>> collect = emps.stream()
        .collect(Collectors.groupingBy((e)->e.getStatus()));
        System.out.println(collect);
        
        
        Map<Status, List<Employee2>> collect2 = emps.stream()
            .collect(Collectors.groupingBy(Employee2::getStatus));
        System.out.println(collect2);
    }
//=====多级==================================================
//多级分组
    @Test
    public void testCollect4() {
        Map<Status, Map<String, List<Employee2>>> collect = emps.stream()
            .collect(Collectors.groupingBy(Employee2::getStatus, Collectors.groupingBy((e)->{
                if(e.getAge() >= 60)
                    return "老年";
                else if(e.getAge() >= 35)
                    return "中年";
                else
                    return "成年";
            })));
        System.out.println(collect);
    }
//===================================================
//多级分组
    @Test
    public void testCollect4() {
        Map<Status, Map<String, List<Employee2>>> collect = emps.stream()
            .collect(Collectors.groupingBy(Employee2::getStatus, Collectors.groupingBy((e)->{
                if(e.getAge() >= 60)
                    return "老年";
                else if(e.getAge() >= 35)
                    return "中年";
                else
                    return "成年";
            })));
        System.out.println(collect);
    }
//==========================================================
//多级分组
    @Test
    public void testCollect4() {
        Map<Status, Map<String, List<Employee2>>> collect = emps.stream()
            .collect(Collectors.groupingBy(Employee2::getStatus, Collectors.groupingBy((e)->{
                if(e.getAge() >= 60)
                    return "老年";
                else if(e.getAge() >= 35)
                    return "中年";
                else
                    return "成年";
            })));
        System.out.println(collect);
    }
//======================================================
//组接字符串
    @Test
    public void testCollect6() {
        String collect = emps.stream()
        .map((e)->e.getName())
        .collect(Collectors.joining());
        System.out.println(collect);
        
        String collect3 = emps.stream()
        .map(Employee2::getName)
        .collect(Collectors.joining(","));
        System.out.println(collect3);
        
        
        String collect2 = emps.stream()
            .map(Employee2::getName)
            .collect(Collectors.joining(",", "prefix", "subfix"));
        System.out.println(collect2);
        
        
    }
    @Test
    public void testCollect7() {
        Optional<Double> collect = emps.stream()
        .map(Employee2::getSalary)
        .collect(Collectors.reducing(Double::sum));
        System.out.println(collect.get());
    }
//==========================================================


总测试代码

    /**
     * collect——将流转换为其他形式。接收一个 Collector接口的实现,用于给Stream中元素做汇总的方法
     */
    @Test
    public void testCollect() {
        
        List<String> collect = emps.stream()
            .map(Employee2::getName)
            .collect(Collectors.toList());
        collect.forEach(System.out::println);
        
        
        Set<String> collect2 = emps.stream()
            .map(Employee2::getName)
            .collect(Collectors.toSet());
        collect2.forEach(System.out::println);
        
        HashSet<String> collect3 = emps.stream()
            .map(Employee2::getName)
            .collect(Collectors.toCollection(HashSet::new));
        collect3.forEach(System.out::println);
    }
    
    @Test
    public void testCollect2() {
        Optional<Double> collect = emps.stream()
            .map(Employee2::getSalary)
            .collect(Collectors.maxBy(Double::compare));
        System.out.println(collect.get());
        
        
        
        Optional<Employee2> collect2 = emps.stream()
            .collect(Collectors.maxBy((e1, e2) -> Double.compare(e1.getSalary(), e2.getSalary())));
        System.out.println(collect2.get());
        
        
        Optional<Double> collect4 = emps.stream()
        .map(Employee2::getSalary)
        .collect(Collectors.minBy(Double::compare));
        System.out.println(collect4);
        
        
        Optional<Employee2> collect3 = emps.stream()
        .collect(Collectors.minBy((e1,e2)->Double.compare(e1.getSalary(),e2.getSalary())));
        System.out.println(collect3.get());
        
        
    System.out.println("=========================================");
    
    Double collect5 = emps.stream()
        .collect(Collectors.summingDouble(Employee2::getSalary));
    System.out.println(collect5);
    
    
    Double collect6 = emps.stream()
    .collect(Collectors.averagingDouble((e)->e.getSalary()));
    Double collect7 = emps.stream()
    .collect(Collectors.averagingDouble(Employee2::getSalary));
    
    System.out.println("collect6:"+collect6);
    System.out.println("collect7:"+collect7);
    
    
    //总数
    Long collect8 = emps.stream()
    .collect(Collectors.counting());
    System.out.println(collect8);
    
    
    
    DoubleSummaryStatistics collect9 = emps.stream()
        .collect(Collectors.summarizingDouble(Employee2::getSalary));
    long count = collect9.getCount();
    double average = collect9.getAverage();
    double max = collect9.getMax();
    double min = collect9.getMin();
    double sum = collect9.getSum();
    System.out.println("count:"+count);
    System.out.println("average:"+average);
    System.out.println("max:"+max);
    System.out.println("min:"+min);
    System.out.println("sum:"+sum);
    }
    
    //分组
    @Test
    public void testCollect3() {
        Map<Status, List<Employee2>> collect = emps.stream()
        .collect(Collectors.groupingBy((e)->e.getStatus()));
        System.out.println(collect);
        
        
        Map<Status, List<Employee2>> collect2 = emps.stream()
            .collect(Collectors.groupingBy(Employee2::getStatus));
        System.out.println(collect2);
    }
    //多级分组
    @Test
    public void testCollect4() {
        Map<Status, Map<String, List<Employee2>>> collect = emps.stream()
            .collect(Collectors.groupingBy(Employee2::getStatus, Collectors.groupingBy((e)->{
                if(e.getAge() >= 60)
                    return "老年";
                else if(e.getAge() >= 35)
                    return "中年";
                else
                    return "成年";
            })));
        System.out.println(collect);
    }
    //分区
    @Test
    public void testCollect5() {
        Map<Boolean, List<Employee2>> collect = emps.stream()
        .collect(Collectors.partitioningBy((e)->e.getSalary()>5000));
        System.out.println(collect);
    }
    //组接字符串
    @Test
    public void testCollect6() {
        String collect = emps.stream()
        .map((e)->e.getName())
        .collect(Collectors.joining());
        System.out.println(collect);
        
        String collect3 = emps.stream()
        .map(Employee2::getName)
        .collect(Collectors.joining(","));
        System.out.println(collect3);
        
        
        String collect2 = emps.stream()
            .map(Employee2::getName)
            .collect(Collectors.joining(",", "prefix", "subfix"));
        System.out.println(collect2);
        
        
    }
    @Test
    public void testCollect7() {
        Optional<Double> collect = emps.stream()
        .map(Employee2::getSalary)
        .collect(Collectors.reducing(Double::sum));
        System.out.println(collect.get());
    }

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

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

相关文章

华为OD机试 - 最多等和不相交连续子序列(C++) | 附带编码思路 【2023】

刷算法题之前必看 参加华为od机试,一定要注意不要完全背诵代码,需要理解之后模仿写出,通过率才会高。 华为 OD 清单查看地址:https://blog.csdn.net/hihell/category_12199283.html 华为OD详细说明:https://dream.blog.csdn.net/article/details/128980730 华为OD机试题…

老学长的浙大MPA现场复试经验分享

作为一名在浙大MPA项目已经毕业的考生来说&#xff0c;很荣幸受到杭州达立易考周老师的邀请&#xff0c;给大家分享下我的复试经验&#xff0c;因为听周老师说是这几年浙大MPA因疫情情况&#xff0c;已经连续几年都是线上个人复试了&#xff0c;而今年疫情社会面较为平稳的情况…

【LoRa模块】关键参数记录

记录lora以及lorawa关键射频参数 这里写目录标题1. LoRa LoRaWAN LPWAN 三者区分2. LoRaWAN网路架构的特点3.关键参数4.参数定义1. LoRa LoRaWAN LPWAN 三者区分 2. LoRaWAN网路架构的特点 终端点的通讯是双向的 (bi-directional)LoRaWAN 数据速率可以从 0.3 kbps 到 50 kbps扩…

7 个 JavaScript Web API 来构建你不知道的未来网站

随着技术的日新月异&#xff0c;为开发人员提供了令人难以置信的新工具和API。但据了解&#xff0c;在100 多个 API中&#xff0c;只有5%被开发人员积极使用。让我们来看看一些有用的Web API&#xff0c;它们可以帮助您将网站推向月球&#xff01;&#x1f315;&#x1f680;1.…

spring5.x-IOC模块源码学习

上文&#xff1a;spring5.x介绍及搭配spring源码阅读环境IOC介绍spring的IOC和DI演示案例com.hong.model.Userpackage com.hong.model;import org.springframework.stereotype.Component;import java.io.Serializable;/** * ClassName User * Description 用户 * Author csh * …

【Java】Spring的创建和使用

Spring的创建和使用 Spring就是一个包含众多工具方法的IOC容器。既然是容器&#xff0c;那么就具备两个最主要的功能&#xff1a; 将对象存储到容器中从容器中将对象取出来 在Java语言当中对象也叫作Bean。 1. 创建Spring项目 创建一个普通maven项目添加Spring框架支持(spri…

Kotlin-面向对象

本片博客主要写创建对象&#xff0c;创建接口&#xff0c;创建抽象类&#xff0c;data关键字的作用 创建对象 如何声明一个对象&#xff0c;使用class关键字 格式为&#xff1a; class 对象名字(对象属性名&#xff1a;属性类型…)&#xff5b;&#xff5d; 如果对象没有函数…

python自学之《21天学通Python》(12)——第15章 线程和进程

现代操作系统大多都是多任务的&#xff0c;可以同时执行多个程序。进程是应用程序正在执行的实体&#xff0c;当程序执行时&#xff0c;也就创建了一个主线程。进程在创建和执行时需要一定的资源&#xff0c;比如内存、文件、I/O设备等。大多现代操作系统中支持多线程和进程。线…

JAVA服务端实现页面截屏(附代码)

JAVA服务端实现页面截屏适配需求方案一、使用JxBrowser使用步骤&#xff1a;方案二、JavaFX WebView使用步骤&#xff1a;方案三、Headless Chrome使用步骤&#xff1a;综上方案对比记录我的一个失败方案参考适配需求 有正确完整的地址url&#xff1b;通过浏览器能打开该url对…

Redis缓存一致性问题(缓存更新策略)

Redis缓存的一致性1. 缓存1.1 缓存的作用&#xff1a;1.2 缓存的成本&#xff1a;2. 缓存模型3. 缓存一致性问题3.1 引入3.2 解决(1) 先更新数据库&#xff0c;再手动删除缓存(2) 使用事务保证原子性(3) 以Redis中的TTL为兜底3.3 案例&#xff1a;商铺信息查询和更新(1) 查询商…

5.12 BGP选路原则综合实验

配置BGP的选路原则 1. 实验目的 熟悉BGP的选路的应用场景掌握BGP的选路的配置方法2. 实验拓扑 实验拓扑如图5-11所示: 图5-11:配置BGP的选路原则 3. 实验步骤 (1)配置IP地址 R1的配置

Spring中自定义Session管理,Spring Session源码解析

系列文章&#xff1a;Spring Boot学习大纲&#xff0c;可以留言自己想了解的技术点 目录 系列文章&#xff1a;Spring Boot学习大纲&#xff0c;可以留言自己想了解的技术点 1、session是什么&#xff1f; 1>session在哪里&#xff1f; 2>服务器怎么知道每次说话的是…

Python + Selenium,分分钟搭建 Web 自动化测试框架!

在程序员的世界中&#xff0c;一切重复性的工作&#xff0c;都应该通过程序自动执行。「自动化测试」就是一个最好的例子。 随着互联网应用开发周期越来越短&#xff0c;迭代速度越来越快&#xff0c;只会点点点&#xff0c;不懂开发的手工测试&#xff0c;已经无法满足如今的…

【Datawhale图机器学习】DeepWalk和Node2Vec

DeepWalk&#xff1a;用于图节点嵌入的在线机器学习算法 论文介绍 DeepWalk是基于随机游走的图节点嵌入算法。首次将深度学习和自然语言处理思想用于图机器学习&#xff0c;将随机游走序列与句子类比&#xff0c;节点与单词类比&#xff0c;构建Word2Vec的Skip-Gram无监督&am…

了解Axios及其运用方式

Axios简介 axios框架全称&#xff08;ajax – I/O – system&#xff09;&#xff1a; 基于promise用于浏览器和node.js的http客户端&#xff0c;因此可以使用Promise API 一、axios是干啥的 说到axios我们就不得不说下Ajax。在旧浏览器页面在向服务器请求数据时&#xff0c;…

计算机网络基础知识

目录 通信基础 前言 广播域与冲突域 计算机之间的连接方式 网线直连&#xff08;交叉线&#xff09; 同轴电缆 集线器 网桥 前言 举例&#xff08;计算机6向计算机7相互通信&#xff09; 交换机 交换机原理 路由器 路由器与其他设备区别&#xff1a; 注意&#…

Docker之路(3.docker底层原理、和虚拟机VM对比区别)

1.docker run 流程图 2. docker 底层原理 2.1 docker 是怎么工作的&#xff1f; Docker 是一个 Client-Server 结构的系统&#xff0c;Docker的守护进程运行在主机上&#xff0c; 通过Socket从客户端访问&#xff01; DockerServer接收到Docker-Client的指令&#xff0c;就会执…

【历史上的今天】2 月 22 日:Red Hat Enterprise Linux 问世;BASIC 语言作者出生;计算机协会创始人诞生

整理 | 王启隆 透过「历史上的今天」&#xff0c;从过去看未来&#xff0c;从现在亦可以改变未来。 今天是 2023 年 2 月 22 日&#xff0c;在 1857 年的今天&#xff0c;德国物理学家海因里希赫兹&#xff08;Heinrich Hertz&#xff09;出生。赫兹于 1887 年首先用实验证实了…

Mysql数据备份

一.数据备份的意义&#xff08;1&#xff09;保护数据的安全&#xff1b;&#xff08;2&#xff09;在出现意外的时候&#xff08;硬盘的损坏&#xff0c;断电&#xff0c;黑客的攻击&#xff09;&#xff0c;以便数据的恢复&#xff1b;&#xff08;3&#xff09;导出生产的数…

【音频处理和分析工具】上海道宁与NUGEN Audio助力您更轻松地提供高质量、合规的音频

NUGEN Audio的产品 可在任何情况下提供 先进的保真度和 不受限制的创造力 提供直接和直观的声音处理方式 NUGEN工具可以更轻松地 提供高质量、合规的音频 同时节省时间 降低成本并保留创作过程 开发商介绍 NUGEN Audio是后期制作、音乐和广播领域的知名品牌&#xff0c…