zoukankan      html  css  js  c++  java
  • Java中常用的方法

    枚举:

    1:DemoEnum.valueOf(String str)  从枚举类中中找字符串,如果有则返回对应枚举值

    2:DemoEnum.values()      获得枚举集合

    3:DemoEnum.property.name()    将枚举类型的属性转为String

    集合循环:

    1:demolist.forEach(oneDemo ->{循环的方法体})  desc:1.8新特性,函数式编程

    2:BeanUtils.copyProperties(Object source,Object target)    desc::将source对象中与target对象相同的属性字段注入到target对象中。

    3:demoList.stream().filter(oneDemo -> condition)。findAny().orElse(null)    desc:从集合中查找符合条件的对象并返回,如果没有则返回null。

    StringUtils常用方法:

    1. public static boolean isEmpty(String str)
    判断某字符串是否为空,为空的标准是str==null或str.length()==0

    2. public static boolean isBlank(String str)
    判断某字符串是否为空或长度为0或由空白符(whitespace)构成

    BigDecimal的四则运算方法:

    public BigDecimal add(BigDecimal value);                        //加法
    public BigDecimal subtract(BigDecimal value);                   //减法 
    public BigDecimal multiply(BigDecimal value);                   //乘法
    public BigDecimal divide(BigDecimal value);                     //除法
  • 相关阅读:
    初窥语义搜索
    爬取菜谱网站
    paramiko简介
    软件项目结构规范
    paramiko 远程执行多个命令
    python 中in 的 用法
    spring依赖(部分)
    ModelAndView的部分回顾
    SringMVC 国际化
    spring事物配置,声明式事务管理和基于@Transactional注解的使用
  • 原文地址:https://www.cnblogs.com/erfsfj-dbc/p/10188131.html
Copyright © 2011-2022 走看看