I have Declared a HashMap as
HashMap minMaxVal = new HashMap();
with K,V as Integer,Float[]
Would Like to retrieve the Min value from hashMap. Overriding the Min Function of collection is only solution for this scenario. How do I approach this.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your
Map<Integer, Float[]>can be converted to aSet<Map.Entry<Integer, Float[]>>usingMap.entrySet(). Once you have this set, you can useCollections.min()to find the minimum value. Your comparator will have to decide how twoMap.Entry<Integer, Float[]>instances compare.I could have given you an example, but you didn’t say what min meant in your case.