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依赖解耦
  • 相关阅读:
    列表框JList 及动作监听
    WindowListener(附带适配器改良方案)
    常用的几种文本组件(JTextComponent)
    JToggleButton组件
    java实现鼠标拖拽动作监听
    Flex读文本文件
    WPF socket通讯 UDP接收消息
    在线签名,并保存到本地
    flex直接访问服务器
    windows 8各种流之间的转换
  • 原文地址:https://www.cnblogs.com/spx88/p/15696942.html
Copyright © 2011-2022 走看看