* Inverts an array of Strings by returning a TreeMap that maps Strings to the smallest index in the array that contains the String.
*
* @param a an array of Strings
* @return a Map that given a String returns the smallest index of the array that contains the String
* (or null if String is not in the array a).
*/
public static TreeMap invert (String[] a) {
//TO DO
return null;
}
/**
* Computes the total number of occurrences of every String in an array.
*
* @param a an array of Strings
* @return a Map that given a String returns the number of occurrences of that String in the array
* (or null if String is not in the array a).
*/
public static TreeMap count (String[] a) {
/ / TODO
return null;
}
}
+4
Answers (1)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Package hw1; import java. util. TreeMap; public class HW1 { /** * Inverts an array of Strings by returning a TreeMap that maps Strings to ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Home » Computers & Technology » Package hw1; import java. util. TreeMap; public class HW1 { /** * Inverts an array of Strings by returning a TreeMap that maps Strings to the smallest index in the array that contains the String.