面白い問題があります
これがオブジェクトの構造です
public class Testdata {
//Which is a consecutive running number i.e 1,2,3..etc
private int sequence;
//classified based on this again any random numbers
private int window;
//need to calculate
private int windowposition;
}
シーケンスとウィンドウに基づいて、ウィンドウに関連するウィンドウ位置を導出する必要があります
テストデータ
したがって、テストデータシーケンス/ウィンドウ
1 / 2
2 / 3
3 / 2
4 / 3
5 / 3
期待される出力
sequence/window : window position would be (in the same order)
1 / 2 : 1
2 / 3 : 1
3 / 2 : 2
4 / 3 : 2
5 / 3 : 3
アップデート:
はい、確かに、私はすでに比較可能なものを実装し、リストを以下の順序に並べ替えました
1 / 2
3 / 2
2 / 3
4 / 3
5 / 3
windowposition
次に、ウィンドウに関連して各要素のを計算するにはどうすればよいですか?