i have an array of strings, it is unsorted and it has duplicate elements. i want to count the distinct elements,but when i call my method it returns number of all elements, not just the distinct ones. any idea please?
public static double countDistinctString(String[] array) {
        double distinctStrings = 0; 
        for (int j = 0; j < array.length; j++){ 
            String thisString = array[j]; 
            boolean seenThisStringBefore = false; 
            for (int i = 0; i < j; i++){ 
                if (thisString == array[i]){ 
                    seenThisStringBefore = true; 
                } 
            } 
            if (!seenThisStringBefore){ 
                distinctStrings++; 
            } 
        } 
        return distinctStrings; 
    }
}
 
     
     
    