EitherTypeInfo extends TypeInformation<Either<L, R>> { @Override public int hashCode() { return 17 * leftType.hashCode() + rightType.hashCode(); } @PublicEvolving  EitherTypeInfo(TypeInformation<L> leftType, TypeInformation<R> rightType); @Override @PublicEvolving boolean isBasicType(); @Override @PublicEvolving boolean isTupleType(); @Override @PublicEvolving int getArity(); @Override @PublicEvolving int getTotalFields(); @SuppressWarnings("unchecked") @Override @PublicEvolving Class<Either<L, R>> getTypeClass(); @Override @PublicEvolving boolean isKeyType(); @Override @PublicEvolving TypeSerializer<Either<L, R>> createSerializer(ExecutionConfig config); @Override String toString(); @SuppressWarnings("unchecked") @Override boolean equals(Object obj); @Override int hashCode(); @Override boolean canEqual(Object obj); TypeInformation<L> getLeftType(); TypeInformation<R> getRightType();  }
@Test public void testEitherTypeInEquality() { EitherTypeInfo<Integer, String> eitherInfo1 = new EitherTypeInfo<Integer, String>( BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO); EitherTypeInfo<Integer, Tuple2<Double, Long>> eitherInfo2 = new EitherTypeInfo<Integer, Tuple2<Double, Long>>( BasicTypeInfo.INT_TYPE_INFO, new TupleTypeInfo<Tuple2<Double, Long>>( TypeExtractor.getForClass(Double.class), TypeExtractor.getForClass(String.class))); assertNotEquals(eitherInfo1, eitherInfo2); assertNotEquals(eitherInfo1.hashCode(), eitherInfo2.hashCode()); }
@Test public void testEitherTypeEquality() { EitherTypeInfo<Integer, String> eitherInfo1 = new EitherTypeInfo<Integer, String>( BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO); EitherTypeInfo<Integer, String> eitherInfo2 = new EitherTypeInfo<Integer, String>( BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO); assertEquals(eitherInfo1, eitherInfo2); assertEquals(eitherInfo1.hashCode(), eitherInfo2.hashCode()); }