zoukankan      html  css  js  c++  java
  • 公司实习常用

    查看当前git配置

    git config --global --list

    修改用户名和公司账号

    git config --global user.name "sunpengxiang"

    git config --global user.email sunpx@mashang.cn


     解除token验证-用于测试接口?devKey=VXiao


     由于公司代码多采用java8流式编程风格,故复习常用java8新特性

    stream 排序、过滤、类型转换

    // 根据年龄排序
    Stream<Student> sorted = list.stream().sorted(Comparator.comparing(Student::getAge));
    sorted.forEach(student -> {
    System.out.println(student.getAge());
    });
    //根据年龄排序并过滤掉等于20的student
    Stream<Student> sorted = list.stream().filter(student -> student.getAge() != 20).sorted(Comparator.comparing(Student::getAge));
    //根据年龄排序并过滤掉等于20的是student,结果集转换为list
    List<Student> studentList = list.stream().filter(student -> student.getAge() != 20).sorted(Comparator.comparing(Student::getAge)).collect(Collectors.toList());
    //利用map获取所有学生年龄
    list.stream().map(Student::getAge).collect(Collectors.toList()).forEach(v -> {
    System.out.println(v);
    });

    Optional.ofNullable的使用
    // 判断stundent的id是否为null,如果不是null则添加至list
    Optional.ofNullable(student1.getId()).ifPresent(v -> {
    list.add(student1);
    });
    list.add(student2);
    list.stream().forEach(l -> {
    System.out.println(l.getName());
    });
    //如果id为空则pId=0L,否则pId=parentId,该方法可有效避免空指针
    Long pId = Optional.ofNullable(parentId).orElse(0L);
    // 获取student姓名
    Optional.ofNullable(student1).map(Student::getName).orElse("no name");
    // 获取student姓名的长度
    Optional.ofNullable(student1.getName()).map(String::length).orElse(0);

     import org.apache.commons.collections.CollectionUtils;
    CollectionUtils的使用
    CollectionUtils.isEmpty 判断集合是否为空

    mapping层
    主要用于DTO对象和ENTITY对象的转换

    handler 层 数据格式校验和service依赖解耦
  • 相关阅读:
    kafka学习-卡不卡的简单使用
    mongoDB-mongo compass使用学习-最像关系型数据库的非关系型文档型数据库
    postman使用-跑男常用功能
    jmeter数据驱动csv+批量导出数据到csv文件
    jmeter-数据库查询与调用-mysql
    arch linux mysql using
    Win10安装 oracle11g 出现INS-13001环境不满足最低要求解决方法
    oracle11g数据库安装
    安装PLSQLDeveloper
    oracle基本学习
  • 原文地址:https://www.cnblogs.com/spx88/p/15696942.html
Copyright © 2011-2022 走看看