我有一个有趣的问题排序Java对象,并根据属性
这里找到相对位置是基于序列和窗口对象结构
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;
}
现在,我需要得到windowposition在相对于窗口
测试数据
所以对于TESTDATA序列/窗口
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
你需要windowsposition = sumOfPreviousWindowById(窗口)+ 1吗? – neworld 2012-08-16 12:24:56
什么问题? – 2012-08-16 12:25:20
@ngmiceli仔细阅读这个问题,你会注意到,如果你仍然没有“现在基于序列和窗口,我将需要派生窗口相对于窗口” – Sudhakar 2012-08-16 13:16:53