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

io.serialized.client.projection.ProjectionsResponse Maven / Gradle / Ivy

The newest version!
package io.serialized.client.projection;

import java.util.Iterator;
import java.util.List;
import java.util.Spliterator;
import java.util.function.Consumer;

import static java.util.Collections.emptyList;
import static java.util.Collections.unmodifiableList;

public class ProjectionsResponse implements Iterable> {

  private List> projections;

  private boolean hasMore;

  public ProjectionsResponse() {
  }

  public ProjectionsResponse(List> projections) {
    this.projections = projections;
  }

  public ProjectionsResponse(List> projections, boolean hasMore) {
    this.projections = projections;
    this.hasMore = hasMore;
  }

  public List> result() {
    return projections == null ? emptyList() : unmodifiableList(projections);
  }

  public boolean hasMore() {
    return hasMore;
  }

  @Override
  public Iterator> iterator() {
    return result().iterator();
  }

  @Override
  public void forEach(Consumer> action) {
    result().forEach(action);
  }

  @Override
  public Spliterator> spliterator() {
    return result().spliterator();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy