
com.jamieswhiteshirt.rtree3i.EmptySelection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rtree-3i-lite Show documentation
Show all versions of rtree-3i-lite Show documentation
Immutable map applying a spatial index to keys based on R-Trees
The newest version!
package com.jamieswhiteshirt.rtree3i;
import java.util.function.*;
import java.util.stream.Collector;
final class EmptySelection implements Selection {
private static final Selection INSTANCE = new EmptySelection();
public static Selection create() {
//noinspection unchecked
return INSTANCE;
}
private EmptySelection() {}
@Override
public Selection filter(Predicate super T> predicate) {
return this;
}
@Override
public void forEach(Consumer super T> action) {
}
@Override
public boolean anyMatch(Predicate super T> predicate) {
return false;
}
@Override
public boolean allMatch(Predicate super T> predicate) {
return true;
}
@Override
public boolean noneMatch(Predicate super T> predicate) {
return true;
}
@Override
public T reduce(T identity, BinaryOperator accumulator) {
return identity;
}
@Override
public R collect(Supplier supplier, BiConsumer accumulator, BiConsumer combiner) {
return supplier.get();
}
@Override
public R collect(Collector super T, A, R> collector) {
A container = collector.supplier().get();
return collector.finisher().apply(container);
}
@Override
public int count() {
return 0;
}
@Override
public boolean isEmpty() {
return true;
}
@Override
public boolean isNotEmpty() {
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy