Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 813 Bytes

File metadata and controls

44 lines (34 loc) · 813 Bytes

Java Collections Playground

JavaCollectionsPlayground

A simple Java program demonstrating the power of the Collections class with an ArrayList<Double> including sorting, binary searching, and filling lists with new values.


🧠 Features

  • Create and print an ArrayList<Double>
  • Sort the list using Collections.sort()
  • Search for a specific value with Collections.binarySearch()
  • Replace all list elements using Collections.fill()

⚙️ How to Run

Make sure Java 21 (or newer) is installed.
Then compile and run the program:

javac src\cop2805\CollectionsDouble.java
java -cp src cop2805.CollectionsDouble

🧾 Example Output

Original List: 1.5 2.35 -4.7 0.01

Sorted List: -4.7 0.01 1.5 2.35

Found 1.5 at index 2 Zero List: 0.0 0.0 0.0 0.0