使用Stream一行获取26个英文字母
发表于|更新于
|浏览量:
成功是从一个失败前进到另一个失败,而期间热情不减的能力。——丘吉尔
代码
1 | List<String> A = Stream.iterate("A", e -> String.valueOf((char) (e.charAt(0) + 1))).limit(26).collect(Collectors.toList()); |
执行结果

相关推荐
2024-10-18
Apache-general邮件订阅
权威如果没有威信就不能成立。威信如果没有世俗的隔离就不能成立。——戴高乐 记载: 发邮件之前首先需要订阅 general@incubator.apache.org 邮件列表,否则邮件会被卡住无法发出。跟订阅ASF的任何邮件列表一样,你可以手动发一则空邮件(随意标题,无内容)至 general-subscribe@incubator.apache.org ,该邮件组的robot会自动引导你进行订阅。 apache 邮件指导: Tips for Apache project email contributors - Apache Infrastructure Website Apache 电子邮件信息的站点地图 Listing of ASF Mailing Lists 邮件列表 Code of Conduct 行为守则 Public Forum Archive Policy 公共论坛档案政策 Additional tips from the Apache Cocoon community 来自Apache Cocoon 社区的其他提示 How to ask Questions...
2021-03-05
避免list中remove导致ConcurrentModificationException
凡不是就着泪水吃过面包的人是不懂得人生之味的人——歌德 我们在list循环中调用remove函数删除自身元素可能会导致java.util.ConcurrentModificationException 例如 1234// 构造从0到20的listList<Integer> list = Stream.iterate(0, i -> ++i).limit(20).collect(Collectors.toList());// 删除list.forEach(list::remove); 首先我们可以使用removeIf代替 1list.removeIf(i -> i.equals(i)); 其次我们可以使用迭代器 我们可以看到removeIf的源码正是使用了迭代器 如下 12345Iterator<Integer> iterator = list.iterator();while (iterator.hasNext()) { Integer nowNumber = iterator.next(); iterator....
2023-06-19
写一个基于lambda的copyProperties
和任何人都认朋友,结果和任何人都交不成朋友。——佚名 代码仓库: https://gitee.com/dromara/stream-query 相关提交: https://gitee.com/dromara/stream-query/commit/31114dbc1374f78aad17daa4da615766d93194a2 使用方式: 123456789@Testvoid testCopyProperties() { LambdaExecutable source = LambdaHelper.resolve( (Serializable & Function<LambdaExecutable, String>) LambdaExecutable::getName); LambdaExecutable target = BeanHelper.copyProperties(source, null); Assertions.assertNotNull(target); Assertions.assertEqu...
2025-12-25
conductor
今天所做之事勿候明天,自己所做之事勿候他人。——歌德 Conductor:源自 Netflix 的可扩展工作流编排引擎当你的系统从“一个应用”演进为“几十上百个微服务 + 一堆事件”,你就会需要一个可靠、可观察、可伸缩的编排引擎,把这些复杂的流程组织起来。Conductor 正是为此而生——它最初由 Netflix 构建,用于管理分布式、异步的微服务与事件驱动工作流;如今由 Orkes 团队在社区中持续维护与发展。 仓库主页:conductor-oss/conductor 官方站点:Conductor OSS README 永久链接(信息来源):README.md@aa7de92 默认分支:main 项目描述(仓库 Description):“Conductor is an event driven orchestration platform providing durable and highly resilient execution engine for your applications” 许可协议:Apache 2.0 进一步了解 Netflix ...
2024-10-11
Apache-ShenYu让h2数据库持久化到文件中
你要记住,在敢于担当培养一个人的任务之前,自己就必须要造成一个人,自己就必须是一个值得推崇的模范。——卢俊 今天发现使用 调试h2数据库 中的方式连接h2数据库却不行,由于目录里没有创建,所以我们得先创建: 123456spring: datasource: url: jdbc:h2:file:~/Downloads/shenyu-study/shenyu;DB_CLOSE_DELAY=-1;MODE=MySQL;SCHEMA=PUBLIC; username: sa password: sa driver-class-name: org.h2.Driver 然后再启动后 123456789101112131415161718192021222324252627282930313233343536373839404142434445/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See...
2020-06-21
java8的stream流
在1.8新特性中有一个stream流 可以对集合进行很多操作,在开发里大量用到 先创建两个类,用于我们操作 12345678910111213141516import java.util.ArrayList;/** * @ClassName: StringList * @Date: 2020/6/21 0021 21:08 * @Description: 一个继承了ArrayList<String>的类 * @Author: <achao1441470436@gmail.com> */public class StringList extends ArrayList<String> { public StringList put(String s) { super.add(s); //用于链式编程 return this; }} 1234567891011121314151617181920212223242526272829303132333435...

阿超
我的名字叫阿超 年龄25岁 家在北京市 职业是软件开发 每天最晚也会在八点前回家 不抽烟 酒浅尝辄止 晚上十二点上床 保证睡足八个小时 睡前写一篇博客 再做二十分钟俯卧撑暖身 然后再睡觉 基本能熟睡到天亮 像婴儿一样不留下任何疲劳和压力 就这样迎来第二天的早晨 健康检查结果也显示我很正常 我想说明我是一个不论何时都追求内心平稳的人 不拘泥于胜负 不纠结于烦恼 不树立使我夜不能寐的敌人 这就是我在这社会的生活态度
Follow Me公告
This is my Blog