• StringJoiner可以嵌套使用的,简单使用常用于抛异常


    package com.gang;
    
    import java.util.Calendar;
    import java.util.Date;
    import java.util.HashSet;
    import java.util.StringJoiner;
    
    public class Harbor007 {
        public static void main(String[] args) {
           /* Calendar calendar = Calendar.getInstance();
    
            calendar.add(Calendar.SECOND,10);
            Date time = calendar.getTime();
            System.out.println(time);*/
    
          /*  HashSet set = new HashSet<>();
            set.add("1");
            set.add("1");
            set.add("1");
            System.out.println(set);*/
    
            StringJoiner notFourMustError = new StringJoiner(",");
            notFourMustError.add("刘备");
            notFourMustError.add("王道哈哈");
                StringJoiner result = new StringJoiner(",");
            System.out.println(notFourMustError);
    
            result.add(notFourMustError + "部分事项未审核,请审核后在结束会议");
    
            System.out.println(result.toString());
    
    
        }
    
    
        }
    
    
    if (notFourMustError.length() != 0 || allFailErrorMessage.length() != 0) {
        StringJoiner result = new StringJoiner(",");
    
        if (notFourMustError.length() != 0) {
            result.add(notFourMustError + "部分事项未审核,请审核后在结束会议");
        }
    
        if (allFailErrorMessage.length() != 0) {
            result.add(allFailErrorMessage + "影响任免,不允许结束会议");
        }
    
        throw new SystemAccountException(result.toString());
    }

    1. package com.gang;
    2. import java.util.Arrays;
    3. import java.util.List;
    4. import java.util.StringJoiner;
    5. import java.util.stream.Collectors;
    6. public class Test08 {
    7. public static void main(String[] args) {
    8. List list = Arrays.asList("大大", "的武当派开完票");
    9. System.out.println(list.stream().collect(Collectors.joining("$$$")));
    10. }
    11. }

     

  • 相关阅读:
    python毕业设计作品基于django框架 电影院购票选座系统毕设成品(5)任务书
    使用mybatis plus自定义拦截器,实现数据权限
    动物园(虚函数与多态)
    基于h5的风云网球网站的设计
    go语言中Map的使用
    ubuntu非源码安装 openCV
    SOA面向服务架构:通信逻辑与SOME/IP消息格式
    学习笔记-IPC$(Internet Process Connection)
    子查询作为检索表时的不同使用场景以及是否需要添加别名的问题
    07_面向对象高级_内部类
  • 原文地址:https://blog.csdn.net/weixin_61503139/article/details/127673131