what the function that removes duplicates in arrays in python code example

Example 1: Write a function that takes in two sorted arrays and returns a new array with all elements sorted not using array method sort.

// const newSortArrays = (arr1, arr2) => {
//     let output = [];
//     while (arr1.length && arr2.length) {
//        if (arr1[0] < arr2[0]) 
//         output.push(arr1[0] < arr2[0] ? arr1.shift() : arr2.shift())
//     }
//     return [...output, ...arr1, ...arr2]
// }

Example 2: how to get all the elements in Hashtable java

// Using hashtable.keySet()

package com.java2novice.hashtable;
 
import java.util.Hashtable;
import java.util.Set;
 
public class MyHashtableKeys {
 
    public static void main(String a[]){
        Hashtable<String, String> hm = new Hashtable<String, String>();
        //add key-value pair to Hashtable
        hm.put("first", "FIRST INSERTED");
        hm.put("second", "SECOND INSERTED");
        hm.put("third","THIRD INSERTED");
        System.out.println(hm);
        Set<String> keys = hm.keySet();
        for(String key: keys){
            System.out.println(key);
        }
    }
}