@Test public void version() { SchemaVersion schemaVersion1 = new SchemaVersion(null, 1, false); SchemaVersion schemaVersion2 = new SchemaVersion(null, 2, false); Optional<SchemaVersion> result = SchemaVersion.version(Arrays.asList(schemaVersion1, schemaVersion2), 1); assertThat(result.isPresent(), is(true)); assertThat(result.get().getVersion(), is(1)); }
public static Optional<SchemaVersion> version(Iterable<SchemaVersion> schemas, int version) { return StreamSupport.stream(schemas.spliterator(), false).filter(s -> s.version == version).findFirst(); }
SchemaVersion { public static Optional<SchemaVersion> version(Iterable<SchemaVersion> schemas, int version) { return StreamSupport.stream(schemas.spliterator(), false).filter(s -> s.version == version).findFirst(); } }
SchemaVersion { public static Optional<SchemaVersion> version(Iterable<SchemaVersion> schemas, int version) { return StreamSupport.stream(schemas.spliterator(), false).filter(s -> s.version == version).findFirst(); } @JsonCreator  SchemaVersion(
      @JsonProperty("schema") Schema schema,
      @JsonProperty("version") int version,
      @JsonProperty("deleted") boolean deleted); }
SchemaVersion { public static Optional<SchemaVersion> version(Iterable<SchemaVersion> schemas, int version) { return StreamSupport.stream(schemas.spliterator(), false).filter(s -> s.version == version).findFirst(); } @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> version(Iterable<SchemaVersion> schemas, int version) { return StreamSupport.stream(schemas.spliterator(), false).filter(s -> s.version == version).findFirst(); } @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);  }