double の配列が与えられた場合
1.0 2.0 3.0 ... 10.0
出力
filter(3,7) should produce 3.0,4.0,5.0,6.0,7.0
filter(5,7.5) should produce 5.0,6.0,7.0,8.0
filter(6.6,6.7) should produce 6.0,7.0
filter
メソッドに基づく
public List<Double> filter(double start, double end){
List<Double> list = Arrays.asList(1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0);
List<Double> resultList = new ArrayList<Double>();
//search in list for elements such that it includes the lower bounds and upper bound of search
//i.e. 6.6 should also include 6.0 and 7.0 from the array.
return resultList;
}
これは簡単に思えますが、満足のいく解決策を思いつくことができなかったので、質問です。どんな助けでも大歓迎です。