• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 888
  • Last Modified:

Java find max element in Vector

Hi everybody
I have v = Vector<Double> and I need to check if a certain given index corresponds to the maximum element in the Vector. In other words, I need to check if
v.get(index) == Collections.max(v)
Obviously the line above doesn't compile since I am comparing a Double and a Object...
0
perissf
Asked:
perissf
  • 2
1 Solution
 
CEHJCommented:
>>v.get(index) == Collections.max(v)

Try instead
v.get(index).equals(Collections.max(v))

Open in new window

0
 
perissfAuthor Commented:
wow!!
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now