org.molgenis.semanticsearch.semantic.Hits Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of molgenis-semantic-search Show documentation
Show all versions of molgenis-semantic-search Show documentation
Semantic data search service functionality.
The newest version!
package org.molgenis.semanticsearch.semantic;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Nonnull;
@AutoValue
@SuppressWarnings("java:S1610") // Abstract classes without fields should be converted to interfaces
public abstract class Hits implements Iterable> {
public abstract List> getHits();
@Override
public @Nonnull Iterator> iterator() {
return getHits().iterator();
}
public boolean hasHits() {
return iterator().hasNext();
}
public static Hits create(List> hits) {
return new AutoValue_Hits<>(ImmutableList.copyOf(hits));
}
@SafeVarargs
public static Hits create(Hit... hits) {
return new AutoValue_Hits<>(ImmutableList.copyOf(hits));
}
}