List of usage examples for java.lang String chars
@Override
public IntStream chars()
From source file:org.sonar.server.plugins.edition.EditionBundledPluginsTest.java
private String randomizeCase(String s) { return s.chars().map(c -> random.nextBoolean() ? Character.toUpperCase(c) : Character.toLowerCase(c)) .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append).toString(); }
From source file:org.talend.dataprep.dataset.service.DataSetServiceTest.java
@Test public void should_remove_any_NUL_character() throws Exception { // given/*from w w w . j a va2s .c o m*/ final String originalContent = IOUtils .toString(this.getClass().getResourceAsStream(DATASET_WITH_NUL_CHAR_CSV)); assertThat(originalContent.chars().anyMatch((c) -> c == '\u0000'), is(true)); final String dataSetId = createCSVDataSet(this.getClass().getResourceAsStream(DATASET_WITH_NUL_CHAR_CSV), "test"); // when final String content = requestDataSetSample(dataSetId, false, "10"); // then assertThat(content, not(containsString("\\u0000"))); }
From source file:passwords.PwGen.java
public int getEntropy(String i) { double c = i.chars().distinct().count(); double l = i.length(); int e = (int) Math.round(l * Math.log(c) / Math.log(2)); return e;/*ww w .ja v a 2 s. c o m*/ }