本文整理了Java中io.vavr.collection.List.forEach()
方法的一些代码示例,展示了List.forEach()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.forEach()
方法的具体详情如下:
包路径:io.vavr.collection.List
类名称:List
方法名:forEach
暂无
代码示例来源:origin: resilience4j/resilience4j
@Test
public void shouldPassPositiveDuration() {
// Given
final List<Long> positiveIntervals = List.of(10L, 99L, 981L);
final List<Duration> positiveDurations = positiveIntervals.map(Duration::ofMillis);
// When
positiveDurations.forEach(IntervalFunction::of);
positiveIntervals.forEach(IntervalFunction::of);
positiveDurations.forEach(IntervalFunction::ofRandomized);
positiveIntervals.forEach(IntervalFunction::ofRandomized);
positiveDurations.forEach(IntervalFunction::ofExponentialBackoff);
positiveIntervals.forEach(IntervalFunction::ofExponentialBackoff);
positiveDurations.forEach(IntervalFunction::ofExponentialRandomBackoff);
positiveIntervals.forEach(IntervalFunction::ofExponentialRandomBackoff);
// Then should pass
}
代码示例来源:origin: resilience4j/resilience4j
@Test
public void shouldPassPositiveRandomizationFactor() {
// Given
final Duration duration = Duration.ofMillis(100);
final float multiplier = 1.5f;
final List<Float> correctFactors = List.of(0.0f, 0.25f, 0.5f, 0.75f, 0.1f);
// When
correctFactors.forEach(v -> IntervalFunction.ofRandomized(duration, v));
correctFactors.forEach(v -> IntervalFunction.ofExponentialRandomBackoff(duration, multiplier, v));
}
代码示例来源:origin: vavr-io/vavr
final AtomicBoolean completed = new AtomicBoolean(false);
final AtomicInteger count = new AtomicInteger(list.length());
list.forEach(future -> future.onComplete(result -> {
synchronized (count) {
代码示例来源:origin: com.pragmaticobjects.oo.atom/atom-basis
@Override
public final void apply() {
sources.forEach(jp -> jp.saveIn(workingDirectory));
}
}
代码示例来源:origin: com.pragmaticobjects.oo.atom/atom-basis
@Override
public final void apply(final ClassPath classPath, final ClassNames classNames, final Path workingDirectory) {
System.out.println();
System.out.println("java.home: " + System.getProperty("java.home"));
System.out.println("java.class.path:");
classPath.paths().forEach(p -> System.out.println(" " + p));
System.out.println();
}
}
代码示例来源:origin: com.io7m.changelog/com.io7m.changelog.xml.vanilla
private static void row(
final Document doc,
final Element releases,
final String date_text,
final List<Node> td_text_nodes)
{
final Element tr =
doc.createElementNS(XHTML_NS, "tr");
final Element td_date =
doc.createElementNS(XHTML_NS, "td");
td_date.setTextContent(date_text);
final Element td_text =
doc.createElementNS(XHTML_NS, "td");
td_text_nodes.forEach(td_text::appendChild);
tr.appendChild(td_date);
tr.appendChild(td_text);
releases.appendChild(tr);
}
代码示例来源:origin: com.io7m.changelog/com.io7m.changelog.xml.vanilla
private void writeRelease(
final Document doc,
final Element releases,
final CVersionType version,
final CRelease release)
{
final Element e_release =
doc.createElementNS(this.schema_uri, "c:release");
e_release.setAttribute(
"date",
this.date_formatter.format(release.date()));
e_release.setAttribute(
"version",
version.toVersionString());
e_release.setAttribute(
"ticket-system",
release.ticketSystemID());
final Element changes =
doc.createElementNS(this.schema_uri, "c:changes");
release.changes().forEach(
change -> this.writeChange(doc, changes, change));
e_release.appendChild(changes);
releases.appendChild(e_release);
}
代码示例来源:origin: com.io7m.changelog/com.io7m.changelog.xml.vanilla
doc.createElementNS(this.schema_uri, "c:tickets");
change_tickets.forEach(ticket -> {
final Element e_ticket =
doc.createElementNS(this.schema_uri, "c:ticket");
代码示例来源:origin: com.io7m.changelog/com.io7m.changelog.text.vanilla
this.writer.newLine();
release.changes().reverse().forEach(change -> {
try {
if (this.config.showDates()) {
代码示例来源:origin: HalBuilder/halbuilder-core
public void validateNamespaces() {
getLinks().forEach(link -> namespaceManager.validateNamespaces(Links.getRel(link)));
resources.forEach(
(key, rel) -> {
namespaceManager.validateNamespaces(key);
rel.validateNamespaces();
});
}
代码示例来源:origin: io.vavr/vavr
final AtomicBoolean completed = new AtomicBoolean(false);
final AtomicInteger count = new AtomicInteger(list.length());
list.forEach(future -> future.onComplete(result -> {
synchronized (count) {
代码示例来源:origin: HalBuilder/halbuilder-core
/**
* Add a link to this resource.
*
* @param links The target link
*/
public ResourceRepresentation<V> withLinks(List<Link> links) {
links.forEach(
link -> {
String rel = Links.getRel(link);
Support.checkRelType(rel);
validateSingletonRel(rel);
});
final TreeMap<String, Rel> updatedRels =
links
.map(Links::getRel)
.foldLeft(
rels,
(accum, rel) ->
!accum.containsKey(rel) ? accum.put(rel, Rels.natural(rel)) : accum);
final List<Link> updatedLinks = this.links.appendAll(links);
return new ResourceRepresentation<>(
content, updatedLinks, updatedRels, namespaceManager, value, resources);
}
代码示例来源:origin: vavr-io/vavr-jackson
@Test
public void test2() throws IOException {
ComplexInnerClass innerSrc = new ComplexInnerClass();
innerSrc.setScalar(10);
innerSrc.setValues(List.of("Data1", "Data2", "Data3"));
ComplexBeanObject src = new ComplexBeanObject();
src.setScalar("Data Scalar");
src.setValues(List.of(
new ComplexInnerClass(10, List.of("Data1", "Data2", "Data3")),
new ComplexInnerClass(12, List.of("Data3", "Data4", "Data5"))
));
String json = mapper().writeValueAsString(src);
ComplexBeanObject restored = mapper().readValue(json, ComplexBeanObject.class);
restored.getValues().forEach(innerClass -> {
Assert.assertTrue("Instance of ComplexInnerClass", innerClass instanceof ComplexInnerClass);
});
Assert.assertEquals(restored, src);
}
内容来源于网络,如有侵权,请联系作者删除!