@Override public SegmentInfos clone(){
  try {
    final SegmentInfos sis=(SegmentInfos)super.clone();
    sis.segments=new ArrayList<>(size());
    for (    final SegmentCommitInfo info : this) {
      assert info.info.getCodec() != null;
      sis.add(info.clone());
    }
    sis.userData=new HashMap<>(userData);
    return sis;
  }
 catch (  CloneNotSupportedException e) {
    throw new RuntimeException("should not happen",e);
  }
}

@ Override public SegmentInfos clone ( ) { try { final SegmentInfos sis = ( SegmentInfos ) super . clone ( ) ; sis . segments = new ArrayList < > ( size ( ) ) ; for ( final SegmentCommitInfo info : this ) { assert info . info . getCodec ( ) != null ; sis . add ( info . clone ( ) ) ; } sis . userData = new HashMap < > ( userData ) ; return sis ; } catch ( CloneNotSupportedException e ) { throw new RuntimeException ( "should not happen" , e ) ; } }
returns a copy of this instance , also copying each segmentinfo .
