我期待有花車(雙打)&整數如下數組 -爪哇 - 原始雙數組轉換成集合
double[] myArr = {0, 0, 95, 9.5, 19, 610.5, 1217, 5.14, 4038.66, 10.23, 7961, 828, 199858, 37325.3};
然後我有這個函數,返回最大&分鐘
public static void getMaxArrVal(double[] myArr) {
myCol = /* Code to convert myarr to collection should come here */
System.out.println(Collections.min(myCol));
System.out.println(Collections.max(myCol));
}
}
getMaxArrVal(myArr);
我在將原始數據類型轉換爲集合時遇到了問題。我嘗試將此轉換爲雙列表,試圖通過將myArr轉換爲char/String來檢查一些東西,但沒有任何工作明顯。
我不斷看到原始數據類型的編譯錯誤。我也嘗試過Double
,但沒有運氣。
我怎麼可能將數組轉換爲集合&這個計算最小/最大值。我會很感激任何幫助她請。
檢查此http://stackoverflow.com/questions/5178854/convert-a -double-array-to-double-arraylist#5178920 – prasad
@prasad是正確的;這個問題本質上是一個確切的重複。 – bcsb1001