@Override
  public boolean equals(@Nullable Object other) {
    if (!(other instanceof PCollectionTuple)) {
      return false;
    }
    PCollectionTuple that = (PCollectionTuple) other;
    return this.pipeline.equals(that.pipeline) && this.pcollectionMap.equals(that.pcollectionMap);
  }
@Test
  public void testEquals() {
    TestPipeline p = TestPipeline.create();
    TupleTag<Long> longTag = new TupleTag<>();
    PCollection<Long> longs = p.apply(GenerateSequence.from(0));
    TupleTag<String> strTag = new TupleTag<>();
    PCollection<String> strs = p.apply(Create.of("foo", "bar"));

    EqualsTester tester = new EqualsTester();
    // Empty tuples in the same pipeline are equal
    tester.addEqualityGroup(PCollectionTuple.empty(p), PCollectionTuple.empty(p));

    tester.addEqualityGroup(
        PCollectionTuple.of(longTag, longs).and(strTag, strs),
        PCollectionTuple.of(longTag, longs).and(strTag, strs));

    tester.addEqualityGroup(PCollectionTuple.of(longTag, longs));
    tester.addEqualityGroup(PCollectionTuple.of(strTag, strs));

    TestPipeline otherPipeline = TestPipeline.create();
    // Empty tuples in different pipelines are not equal
    tester.addEqualityGroup(PCollectionTuple.empty(otherPipeline));
    tester.testEquals();
  }