Try this:
List<Double> list = Arrays.asList(1.38, 2.56, 4.3);
which returns a fixed size list.
If you need an expandable list, pass this result to the ArrayList
constructor:
List<Double> list = new ArrayList<>(Arrays.asList(1.38, 2.56, 4.3));
Related Posts:
- How to avoid “ConcurrentModificationException” while removing elements from `ArrayList` while iterating it? [duplicate]
- When to use LinkedList over ArrayList in Java?
- Convert list to array in Java [duplicate]
- Convert String to double in Java
- Initialization of an ArrayList in one line
- How to avoid java.util.ConcurrentModificationException when iterating through and removing elements from an ArrayList
- How to sort an ArrayList?
- What’s the C++ version of Java’s ArrayList
- Create ArrayList from array
- Best way to convert an ArrayList to a string
- “Exception in thread “main” java.lang.IndexOutOfBoundsException: Index: 0, Size: 0″ with ArrayList?
- Converting double to integer in Java
- Best way to convert an ArrayList to a string
- Print ArrayList
- Print ArrayList
- Round a double to 2 decimal places [duplicate]
- Round a double to 2 decimal places [duplicate]
- How to make a deep copy of Java ArrayList
- Round a double to 2 decimal places
- How do I limit the number of decimals printed for a double?
- Array ArrayList python equivalent
- Java ArrayList copy
- How do I limit the number of decimals printed for a double?
- how to iterate in List
- > in java and set their values as we do in a normal int a[i][j] matrix type [duplicate]
- Double array initialization in Java
- How to convert an ArrayList containing Integers to primitive int array?
- Print ArrayList
- Why do I get an UnsupportedOperationException when trying to remove an element from a List?
- HashSet vs. ArrayList
- Java ArrayList replace at specific index
- How can I create an Array of ArrayLists?
- How to create an 2D ArrayList in java?
- Error: cannot find symbol ArrayList
- Double decimal formatting in Java
- java howto ArrayList push, pop, shift, and unshift
- Double cannot be dereferenced?
- How to implement infinity in Java?
- How can I truncate a double to only two decimal places in Java?
- Java double.MAX_VALUE?
- How to get the last value of an ArrayList
- How can I truncate a double to only two decimal places in Java?
- How to add an object to an ArrayList in Java
- Add String Array to ArrayList
- Incompatible types List of List and ArrayList of ArrayList
- What do F and D mean at the end of numeric literals?
- Size has private access in ArrayList
- How to write a test class to test my code?
- How to convert a String into an ArrayList?
- How to create a Multidimensional ArrayList in Java?
- convert string to arraylist
in java - What is the difference between “Double” and “double” in Java?
- What is the difference between ArrayList.clear() and ArrayList.removeAll()?
- Convert float to double without losing precision
- ShoppingCart.Java Program Assignment
- How Do I Implement an Insertion Sort Method for A Generic ArrayList?
- toring and Retrieving ArrayList values from hashmap
- return an ArrayList method
- Convert double to float in Java
- What is a stack trace, and how can I use it to debug my application errors?
- How to fix “A JNI error has occurred, please check your installation.”
- Java Runtime Environment not found error when I open an application
- “PKIX path building failed” and “unable to find valid certification path to requested target”
- What exactly does a jar file contain?
- error upon assigning Layout: BoxLayout can’t be shared
- Why do this() and super() have to be the first statement in a constructor?
- Else without if
- Keytool is not recognized as an internal or external command
- Cannot find “Package Explorer” view in Eclipse
- Error: Could not find or load main class in intelliJ IDE
- Java Hashmap: How to get key from value?
- restart console on Minecraft Server
- SSL peer shut down incorrectly in Java
- Java split string to array
- How can I clear or empty a StringBuilder?
- Converting String Array to an Integer Array
- How to fix “unsupported class file major version 60” in IntelliJ?
- Resize an Array while keeping current elements in Java?
- Access restriction: The type ‘Application’ is not API (restriction on required library rt.jar)
- Assign the negativeCntr with the number of negative values in the linked list
- intellij incorrectly saying no beans of type found for autowired repository
- Web server failed to start. Port 8080 was already in use. Spring Boot microservice
- How to check if object is null or not except == null
- Comparing strings by their alphabetical order
- exposed beyond app through ClipData.Item.getUri
- Java – get the current class name?
- Warning: The method assertEquals from the type Assert is deprecated
- koch snowflake java recursion
- Java word count program
- How to “wait” a Thread in Android
- How to use regex in String.contains() method in Java
- Error: Module not specified (IntelliJ IDEA)
- Checking letter case (Upper/Lower) within a string in Java
- How to swap String characters in Java?
- Exception in thread “main” java.net.ConnectException: Connection refused: connect Socket Programming Java
- Why is there no multiple inheritance in Java, but implementing multiple interfaces is allowed?
- Resource leak: ‘in’ is never closed
- How to extract .war files in java? ZIP vs JAR
- What is the difference between run-time error and compiler error?
- Test if element is present using Selenium WebDriver?
- Increase heap size in Java