Last active
January 27, 2020 10:06
-
-
Save prameshbajra/c835a617f2f99a2f995338b78d5e7921 to your computer and use it in GitHub Desktop.
Clone an Object/Arraylist in java.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Date; | |
import java.util.List; | |
public class Assets { | |
public String formatId; | |
public String formatName; | |
public String assetId; | |
public String uploadedby; | |
public String uploadedById; | |
public Date uploadedon; | |
public String size; | |
public String formatStatus; | |
public TransactionVO distributionData; | |
public Boolean singleFile; | |
public String ePubCheckerToolVersion; | |
public String ePubCheckerStatus; | |
public List<FileDetails> fileDetails; | |
public Assets() { | |
} | |
// This is very necessary ... | |
public Assets(Assets assets) { | |
this.formatId = assets.formatId; | |
this.formatName = assets.formatName; | |
this.assetId = assets.assetId; | |
this.uploadedby = assets.uploadedby; | |
this.uploadedById = assets.uploadedById; | |
this.uploadedon = assets.uploadedon; | |
this.size = assets.size; | |
this.formatStatus = assets.formatStatus; | |
this.distributionData = assets.distributionData; | |
this.singleFile = assets.singleFile; | |
this.ePubCheckerToolVersion = assets.ePubCheckerToolVersion; | |
this.ePubCheckerStatus = assets.ePubCheckerStatus; | |
this.fileDetails = assets.fileDetails; | |
} | |
public Assets(String formatId, String formatName, String assetId, String uploadedby, String uploadedById, | |
Date uploadedon, String size, String formatStatus, TransactionVO distributionData, Boolean singleFile, | |
String ePubCheckerToolVersion, String ePubCheckerStatus, List<FileDetails> fileDetails) { | |
super(); | |
this.formatId = formatId; | |
this.formatName = formatName; | |
this.assetId = assetId; | |
this.uploadedby = uploadedby; | |
this.uploadedById = uploadedById; | |
this.uploadedon = uploadedon; | |
this.size = size; | |
this.formatStatus = formatStatus; | |
this.distributionData = distributionData; | |
this.singleFile = singleFile; | |
this.ePubCheckerToolVersion = ePubCheckerToolVersion; | |
this.ePubCheckerStatus = ePubCheckerStatus; | |
this.fileDetails = fileDetails; | |
} | |
public List<FileDetails> getFileDetails() { | |
return fileDetails; | |
} | |
public void setFileDetails(List<FileDetails> fileDetails) { | |
this.fileDetails = fileDetails; | |
} | |
public String getAssetId() { | |
return assetId; | |
} | |
public void setAssetId(String assetId) { | |
this.assetId = assetId; | |
} | |
public String getFormatId() { | |
return formatId; | |
} | |
public void setFormatId(String formatId) { | |
this.formatId = formatId; | |
} | |
public String getSize() { | |
return size; | |
} | |
public void setSize(String size) { | |
this.size = size; | |
} | |
public String getFormatName() { | |
return formatName; | |
} | |
public void setFormatName(String formatName) { | |
this.formatName = formatName; | |
} | |
public String getUploadedby() { | |
return uploadedby; | |
} | |
public void setUploadedby(String uploadedby) { | |
this.uploadedby = uploadedby; | |
} | |
public String getUploadedById() { | |
return uploadedById; | |
} | |
public void setUploadedById(String uploadedById) { | |
this.uploadedById = uploadedById; | |
} | |
public Date getUploadedon() { | |
return uploadedon; | |
} | |
public void setUploadedon(Date uploadedon) { | |
this.uploadedon = uploadedon; | |
} | |
public String getFormatStatus() { | |
return formatStatus; | |
} | |
public void setFormatStatus(String formatStatus) { | |
this.formatStatus = formatStatus; | |
} | |
public TransactionVO getDistributionData() { | |
return distributionData; | |
} | |
public void setDistributionData(TransactionVO distributionData) { | |
this.distributionData = distributionData; | |
} | |
public Boolean getSingleFile() { | |
return singleFile; | |
} | |
public void setSingleFile(Boolean singleFile) { | |
this.singleFile = singleFile; | |
} | |
public String getePubCheckerToolVersion() { | |
return ePubCheckerToolVersion; | |
} | |
public void setePubCheckerToolVersion(String ePubCheckerToolVersion) { | |
this.ePubCheckerToolVersion = ePubCheckerToolVersion; | |
} | |
public String getePubCheckerStatus() { | |
return ePubCheckerStatus; | |
} | |
public void setePubCheckerStatus(String ePubCheckerStatus) { | |
this.ePubCheckerStatus = ePubCheckerStatus; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Assets> formats = <LIST WITH LOTS OF DATA> | |
// newFormatList will be deep cloned and changes to this list will not be reflected to formats list ... | |
List<Assets> newFormatList = formats.stream().map(Assets::new).collect(Collectors.toList()); | |
for (Assets format : newFormatList) { | |
format.setFileDetails(null); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment