Use case:
Fetch all the clips URL from s3 as list of strings . Then Submit the list clip to summary.
public static void main(String[] args) {
List<String> randomStringList = getListOfRandomeStrings();
}
static List<String> getListOfRandomeStrings() {
List<String> randomStringList = new ArrayList<>();
// Add 2k strings to randomStringList
return randomStringList;
}
static void iterateList(List<String> randomStrings) {
// Iterate and print strings
}
Questions
1) When the Strings from string pool will be garbage collected?
2) Is there any way to clean the strings?
3) Does using Weak-reference helps?
Refereed this link, but not still not clear When will a string be garbage collected in java