All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.molgenis.semanticsearch.semantic.Hits Maven / Gradle / Ivy

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));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy