StreamRecord extends StreamElement { public StreamRecord<T> copy(T valueCopy) { StreamRecord<T> copy = new StreamRecord<>(valueCopy); copy.timestamp = this.timestamp; copy.hasTimestamp = this.hasTimestamp; return copy; } StreamRecord(T value);  StreamRecord(T value, long timestamp); T getValue(); long getTimestamp(); boolean hasTimestamp(); @SuppressWarnings("unchecked") StreamRecord<X> replace(X element); @SuppressWarnings("unchecked") StreamRecord<X> replace(X value, long timestamp); void setTimestamp(long timestamp); void eraseTimestamp(); StreamRecord<T> copy(T valueCopy); void copyTo(T valueCopy, StreamRecord<T> target); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testCopy() { StreamRecord<String> recNoTimestamp = new StreamRecord<String>("test"); StreamRecord<String> recNoTimestampCopy = recNoTimestamp.copy("test"); assertEquals(recNoTimestamp, recNoTimestampCopy); StreamRecord<String> recWithTimestamp = new StreamRecord<String>("test", 99); StreamRecord<String> recWithTimestampCopy = recWithTimestamp.copy("test"); assertEquals(recWithTimestamp, recWithTimestampCopy); }