Schema implements Serializable { public boolean equivalent(Schema other) { return equivalent(other, EquivalenceNullablePolicy.SAME); } Schema(List<Field> fields);  Schema(List<Field> fields, Options options); static Builder builder(); static Schema of(Field... fields); Schema withOptions(Options options); Schema withOptions(Options.Builder optionsBuilder); void setUUID(UUID uuid); Map<String, Integer> getEncodingPositions(); void setEncodingPositions(Map<String, Integer> encodingPositions); @Nullable UUID getUUID(); @Override boolean equals(@Nullable Object o); boolean typesEqual(Schema other); boolean equivalent(Schema other); boolean assignableTo(Schema other); boolean assignableToIgnoreNullable(Schema other); @Override String toString(); @Override int hashCode(); List<Field> getFields(); static Collector<Field, List<Field>, Schema> toSchema(); List<String> getFieldNames(); Field getField(int index); Field getField(String name); int indexOf(String fieldName); boolean hasField(String fieldName); String nameOf(int fieldIndex); int getFieldCount(); Options getOptions();  }
@Test public void testEquivalent() { final Schema expectedNested1 = Schema.builder().addStringField("yard1").addInt64Field("yard2").build(); final Schema expectedSchema1 = Schema.builder() .addStringField("field1") .addInt64Field("field2") .addRowField("field3", expectedNested1) .addArrayField("field4", FieldType.row(expectedNested1)) .addMapField("field5", FieldType.STRING, FieldType.row(expectedNested1)) .build(); final Schema expectedNested2 = Schema.builder().addInt64Field("yard2").addStringField("yard1").build(); final Schema expectedSchema2 = Schema.builder() .addMapField("field5", FieldType.STRING, FieldType.row(expectedNested2)) .addArrayField("field4", FieldType.row(expectedNested2)) .addRowField("field3", expectedNested2) .addInt64Field("field2") .addStringField("field1") .build(); assertNotEquals(expectedSchema1, expectedSchema2); assertTrue(expectedSchema1.equivalent(expectedSchema2)); }