list - Generate values based on input in java -
list - Generate values based on input in java -
lets have list of objects:
list<sensordata> sensordatalist = xyz
this list has 100 objects in it. need have length of 300, 200 objects needs generated , inserted list.
i have generation algorithm insert new values between existing ones, old list gets strechted. new values should generated existing ones - illustration average of 2 elements in past , 2 elements in future.
is there existant utilize that?
thanks!
without knowing algorithm using add together objects, hard recommend anything. imagine somehow calculated element set list. realize needs go @ index 50 example. since list filled 0-99, 50 taken. there many ways can add together element @ position, should happen other elements? should move over? should set old element end? how impact calculating algorithm? many questions!
however, there pattern here. going create assumptions: seems similar have natural ordering of elements. run calculations on whole info construction determine how add together new element. add together info construction , have whole info construction update order maintained. want perform calculation on whole info construction 1 time again determine next element should go. rinse , repeat 200 new elements trying add. right here?
if case one, (if don't want write info construction yourself) may priorityqueue might candidate. challenge define how items should ordered, can compared properly.
if using int index for example, wouldn't work simply, because can have generated same id based on algorithm , have many ids of same type. need remove element id generated (if exists in heap), alter id (somehow) , set both old elements , new 1 on heap. next challenge, depends on trying achieve.
i take @ priorityqueue , don't afraid modify or other info structures fit need! learning opportunity, if reinventing wheel extend.
java list generator
Comments
Post a Comment