📌  相关文章
📜  计算字符串中字符的出现次数 java 8 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:23.346000             🧑  作者: Mango

代码示例1
String someString = "elephant";
long count = someString.chars().filter(ch -> ch == 'e').count();
assertEquals(2, count);
 
long count2 = someString.codePoints().filter(ch -> ch == 'e').count();
assertEquals(2, count2);