de.scravy.bedrock.hlist.C Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bedrock Show documentation
Show all versions of bedrock Show documentation
Essential utilities for modern Java.
The newest version!
package de.scravy.bedrock.hlist;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
import lombok.Value;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Objects;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
@Value
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
@EqualsAndHashCode(callSuper = false)
public class C> extends HList> {
private final E head;
private final L tail;
@Override
public int size() {
return 1 + tail.size();
}
@Override
public T foldl(@Nonnull final BiFunction f, final T init) {
return tail.foldl(f, f.apply(init, head));
}
@Override
public T foldr(@Nonnull final BiFunction