Java find max element in Vector

Posted on 2009-02-08
Last Modified: 2012-05-06
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...
Question by:perissf
    LVL 86

    Accepted Solution

    >>v.get(index) == Collections.max(v)

    Try instead

    Open in new window


    Author Closing Comment

    LVL 86

    Expert Comment


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    linearIn  challenge 23 54
    Fix45 challenge 15 66
    scoresSpecial  challenge 13 35
    sumDigits  challenge 7 40
    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now