Skip to content

Latest commit

 

History

7 提交

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

仓库 files navigation

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()
  • 搜索 for a specific value with Collections.binary搜索()
  • 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

关于

Java Collections demo - sorting, searching, and filling ArrayLists using the Collections framework.

Topics

Resources

Stars

1 star

关注者

0 watching

复刻s

发布

贡献者

Languages