🌐
Scientech Easy
scientecheasy.com › home › blog › java double class
Java Double Class - Scientech Easy
February 3, 2025 - This is called boxing in java. 2. Double(String str): This constructor accepts a parameter of String type and converts that string into Double class object. The string contains a double value. The general syntax to create a Double object by wrapping a string that contains a double number, as:
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-lang-double-class-java
Java.Lang.Double Class in Java - GeeksforGeeks
July 23, 2025 - There are mainly two constructors to initialize a Double-object. A. Double(double b): Creates a Double-object initialized with the value provided where it takes a value with which to initialize as a parameter.
🌐
TutorialsPoint
tutorialspoint.com › article › convert-double-primitive-type-to-a-double-object-in-java
Convert double primitive type to a Double object in Java
To convert double primitive type to a Double object, you need to use Double constructor. Let’s say the following is our double primitive. To convert it to a Double object, use Double constructor.
🌐
Tutorialspoint
tutorialspoint.com › java › lang › java_lang_double.htm
Java - Double class
An object of type Double contains a single field whose type is double. Following is the declaration for java.lang.Double class − · public final class Double extends Number implements Comparable<Double> Following are the fields for java.lang.Double class − · static int MAX_EXPONENT − This is the maximum exponent a finite double variable may have.
🌐
Educative
educative.io › home › courses › ace the ap computer science exam for high schoolers › java wrapper class: double
Java Wrapper Class: Double
The Double class is part of the java.lang package. The Double class is a wrapper class for the primitive type double. It contains several methods to deal with double type values effectively. An object of Double class can hold a single double value. ... Let’s cover them one by one. This constructor constructs a new Double object that represents the specified double value. Look at the program below. ... Look at line 5. We create the Double object, called x.
🌐
Delft Stack
delftstack.com › home › howto › java › double in java
Double in Java | Delft Stack
October 12, 2023 - Just like int has Integer, the float has Float in the same way double has the Double class to create objects of primitive double values.
🌐
CodeGym
codegym.cc › java blog › java numbers › java double keyword
Java double keyword
February 19, 2025 - Let's give some examples of using the Java double keyword to create a variable. double myPrice = 5.0; double height = 180; double x = 7.1, y = 3.0; Here in the variable myPrice we have the value 5.0, in the variable height — 180, in x we put ...
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › Double.html
Double (Java Platform SE 8 )
July 21, 2026 - Java™ Platform Standard Ed. 8 ... The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double. In addition, this class provides several methods for converting a double to a String and a String to a double, as well as other constants and methods useful when dealing with a double.
Find elsewhere
Top answer
1 of 2
3

You need to create a class for that that will hold exactly these two values:

import java.util.*;

class MyValuePair {
    private int intValue;
    private double doubleValue;

    MyValuePair(double doubleValue, int intValue) {
        this.intValue = intValue;
        this.doubleValue = doubleValue;
    }

    //Getter and Setter as well as constructor(s) as needed
    public String toString() {
        return "(" + doubleValue + ", " + intValue + ")";
    }

}

public class Dijkstra {

    static Map<Integer, MyValuePair> map = new HashMap<>();

    public static void main(String[] args) {
        MyValuePair pair = new MyValuePair(4.0, 5);
        map.put(1, pair);
        System.out.println(map);
    }

}

So your value pairs go in MyValuePair and the objects of that class will go in the Map. You can create a new public class for it if you need (= in a new file with public keyword) or leave it in there as internal class.

Anything else with Lists and whatever you need will go in the Dijkstra class.

After the comment:

As said it is possible! But you do not want to do that. However this would be a code that would do the same where the Dijkstra class holds the values as well:

public class Dijkstra {

    static Map<Integer, Dijkstra> map = new HashMap<>();

    private double doubleValue;
    private int intValue;

    public Dijkstra(int intValue, double doubleValue) {
        this.intValue = intValue;
        this.doubleValue = doubleValue;
    }

    public String toString() {
        return "(" + doubleValue + ", " + intValue + ")";
    }

    public static void main(String[] args) {
        Dijkstra pair = new Dijkstra(4.0, 5);
        map.put(1, pair);
        System.out.println(map);
    }

}
2 of 2
1

You should create a new class representing whatever your int and double parameters represent as:

public class MyRepresentaion{
    private int myInt;
    private double myDouble;

    public MyRepresentation(int myInt, double myDouble){
        this.myInt = myInt;
        this.myDouble = myDouble;
    }

    public int getMyInt(){
        return myInt;
    }
    public double getMyDouble(){
        return myDouble;
    }
    public void setMyInt(int value){
        myInt = value;
    }
    public void setMyDouble(double value){
        myDouble = value;
    }
}

You should then just put your MyRepresentaion object in the map:

public Map mymethod() {
    Map<Integer, MyRepresentaion> m = new HashMap<Integer, MyRepresentaion>();
}
🌐
Oracle
docs.oracle.com › javase › 7 › docs › api › java › lang › Double.html
Double (Java Platform SE 7 )
Next, the exponent is represented by "p" followed by a decimal string of the unbiased exponent as if produced by a call to Integer.toString on the exponent value. If m is a double value with a subnormal representation, the significand is represented by the characters "0x0." followed by a hexadecimal representation of the rest of the significand as a fraction. Trailing zeros in the hexadecimal representation are removed. Next, the exponent is represented by "p-1022". Note that there must be at least one nonzero digit in a subnormal significand. ... Returns a Double object holding the double value represented by the argument string s.
🌐
DataCamp
datacamp.com › doc › java › double
double Keyword in Java: Usage & Examples
The double keyword in Java is a primitive data type that represents a double-precision 64-bit IEEE 754 floating point. It is used to store decimal numbers with a higher degree of precision compared to the float data type.
🌐
W3Schools
w3schools.com › java › java_classes.asp
Java Classes and Objects
To create a class, use the keyword class. In this example, we create a class named "Main" with a variable x: ... Remember from the Java Syntax chapter that a class should always start with an uppercase first letter, and that the name of the java file should match the class name. In Java, an object is created from a class.
🌐
Oracle
docs.oracle.com › javase › 6 › docs › api › java › lang › Double.html
Double (Java Platform SE 6)
Next, the exponent is represented by "p" followed by a decimal string of the unbiased exponent as if produced by a call to Integer.toString on the exponent value. If m is a double value with a subnormal representation, the significand is represented by the characters "0x0." followed by a hexadecimal representation of the rest of the significand as a fraction. Trailing zeros in the hexadecimal representation are removed. Next, the exponent is represented by "p-1022". Note that there must be at least one nonzero digit in a subnormal significand. ... Returns a Double object holding the double value represented by the argument string s.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › java.lang.double
Double Class (Java.Lang) | Microsoft Learn
Microsoft makes no warranties, express or implied, with respect to the information provided here. The Double class wraps a value of the primitive type double in an object. [Android.Runtime.Register("java/lang/Double", DoNotGenerateAcw=true)] public sealed class Double : Java.Lang.Number, IConvertible, IDisposable, Java.Lang.IComparable
🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › lang › Double.html
Double (Java SE 17 & JDK 17)
April 21, 2026 - The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double. In addition, this class provides several methods for converting a double to a String and a String to a double, as well as other constants and methods useful when dealing with a double.
🌐
BeginnersBook
beginnersbook.com › 2013 › 12 › how-to-convert-string-to-double-in-java
Java Convert String to Double examples
September 11, 2022 - Double class has a constructor ... public Double(String s) throws NumberFormatException · Using this constructor we can create a new object of the Double class by passing the String that we want to convert....
🌐
Oracle
docs.oracle.com › en › java › javase › 24 › docs › api › java.base › java › lang › Double.html
Double (Java SE 24 & JDK 24)
July 15, 2025 - The Double class is the wrapper class for values of the primitive type double. An object of type Double contains a single field whose type is double. In addition, this class provides several methods for converting a double to a String and a String to a double, as well as other constants and methods useful when dealing with a double.