V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
haitaoli
V2EX  ›  程序员

我也分享一段前辈的代码,哈哈

  •  
  •   haitaoli · 316 天前 · 2346 次点击
    这是一个创建于 316 天前的主题,其中的信息可能已经有所发展或是发生改变。
    List<HighxjRollVo> collect9 = highxjRollVoList.stream().filter(x -> x.getGradets().length() == 1 && gradelist.contains(x.getGradets())).filter(x -> !((Calendar.getInstance().get(Calendar.MONTH) + 1)-8 >0 ? ("20"+String.valueOf(Integer.valueOf(x.getHighStudentId().substring(0, 2))+Integer.valueOf(x.getGradets())-10)).equals(yearLast) : ("20"+String.valueOf(Integer.valueOf(x.getHighStudentId().substring(0, 2))+Integer.valueOf(x.getGradets())-10)).equals(beforeYearLast))).collect(Collectors.toList());
    

    前辈写的,而且没有换行,全在一行里面
    给我看的头疼,我都是让 gpt 帮我解释一下这行代码干了啥🤣

    9 条回复    2023-06-21 11:02:58 +08:00
    OutOfMemoryError
        1
    OutOfMemoryError  
       316 天前
    idea 一键格式化不就好了么 这个项目的
    hhjswf
        2
    hhjswf  
       316 天前 via Android
    咋一看像前端混淆的代码
    PungentSauce
        3
    PungentSauce  
       316 天前
    就俩过滤
    chenPiMeiHaoChi
        4
    chenPiMeiHaoChi  
       316 天前
    道理我都懂,但为什么是 collect9 ?想想还有 12345678 就更吓人了。
    assiadamo
        5
    assiadamo  
       316 天前
    ```
    List<String> list = new ArryList<>();
    for (int i = 0; i < strs.length; i++) {
    if (list.contains(strs[i]))
    continue;
    list.add(strs[i]);
    }
    ```
    刚刚看到的代码
    haitaoli
        6
    haitaoli  
    OP
       316 天前
    @chenPiMeiHaoChi 哈哈 看的好细 总共 collect29🤣
    yazinnnn
        7
    yazinnnn  
       316 天前


    贴个刚写的烂代码
    jasonjames
        8
    jasonjames  
       316 天前
    大佬 囚牢囚牢
    @haitaoli
    Jarred711
        9
    Jarred711  
       311 天前
    In summary, the code filters a list of HighxjRollVo objects based on specific conditions using Java 8 Stream API. The resulting filtered elements are collected into a new list assigned to the collect9 variable.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2726 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 11:27 · PVG 19:27 · LAX 04:27 · JFK 07:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.