<repo_name>rajatkumar-96/java-problem-5<file_sep>/setSorter.java
import java.util.*;
class setSorter{
    public static void main(String[] args) {
        System.out.println("ENTER THE NUMBER OF STRINGS YOU WANT TO ADD");
        TreeSet<String> treeSet= new TreeSet<String>();
        Scanner input= new Scanner(System.in);
        int num= input.nextInt();
        for(int i=0;i<num;i++){
            String str=input.next();
            treeSet.add(str);
        }
        List<String> li=new ArrayList<String>(treeSet);
        System.out.println(li);

    }
}<file_sep>/arraylistreplace.java
import java.util.*;
import java.lang.*;
public class arraylistreplace{
    public static void main(String[] args) {
        ArrayList<String> newlist= new ArrayList<String>();
    newlist.add("Apple");
    newlist.add("Grape");
    newlist.add("Melon");
    newlist.add("Berry");
    String replacer="Kiwi";
    Scanner input= new Scanner(System.in);
    System.out.println("Enter the index you want to replace:");
    int index= input.nextInt();
    newlist.set(index, replacer);
    for(String str1:newlist){
        System.out.println(str1);
    }
    }

    

}