@Test public void latestDeleted() { SchemaVersion schemaVersion1 = new SchemaVersion(null, 1, false); SchemaVersion schemaVersion2 = new SchemaVersion(null, 2, true); Optional<SchemaVersion> result = SchemaVersion.latest(Arrays.asList(schemaVersion1, schemaVersion2)); assertThat(result.isPresent(), is(true)); assertThat(result.get().getVersion(), is(1)); }
public static Optional<SchemaVersion> latest(Iterable<SchemaVersion> schemas) { return StreamSupport.stream(schemas.spliterator(), false).filter(s -> !s.isDeleted()).max( (s1, s2) -> s1.version - s2.version); }
SchemaVersion { public static Optional<SchemaVersion> latest(Iterable<SchemaVersion> schemas) { return StreamSupport.stream(schemas.spliterator(), false).filter(s -> !s.isDeleted()).max( (s1, s2) -> s1.version - s2.version); } }
SchemaVersion { public static Optional<SchemaVersion> latest(Iterable<SchemaVersion> schemas) { return StreamSupport.stream(schemas.spliterator(), false).filter(s -> !s.isDeleted()).max( (s1, s2) -> s1.version - s2.version); } @JsonCreator  SchemaVersion(
      @JsonProperty("schema") Schema schema,
      @JsonProperty("version") int version,
      @JsonProperty("deleted") boolean deleted); }
SchemaVersion { public static Optional<SchemaVersion> latest(Iterable<SchemaVersion> schemas) { return StreamSupport.stream(schemas.spliterator(), false).filter(s -> !s.isDeleted()).max( (s1, s2) -> s1.version - s2.version); } @JsonCreator  SchemaVersion(
      @JsonProperty("schema") Schema schema,
      @JsonProperty("version") int version,
      @JsonProperty("deleted") boolean deleted); static Optional<SchemaVersion> latest(Iterable<SchemaVersion> schemas); static Optional<SchemaVersion> version(Iterable<SchemaVersion> schemas, int version); }
SchemaVersion { public static Optional<SchemaVersion> latest(Iterable<SchemaVersion> schemas) { return StreamSupport.stream(schemas.spliterator(), false).filter(s -> !s.isDeleted()).max( (s1, s2) -> s1.version - s2.version); } @JsonCreator  SchemaVersion(
      @JsonProperty("schema") Schema schema,
      @JsonProperty("version") int version,
      @JsonProperty("deleted") boolean deleted); static Optional<SchemaVersion> latest(Iterable<SchemaVersion> schemas); static Optional<SchemaVersion> version(Iterable<SchemaVersion> schemas, int version);  }