aspose file tools*
The moose likes Beginning Java and the fly likes adding and incrementing data structure elements simultaneously with a faster time possible Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

adding and incrementing data structure elements simultaneously with a faster time possible

Moulay Driss
Greenhorn

Joined: May 05, 2013
Posts: 5
I need to add the new element and increment the other objects of an array of objects (elemt) simultaneously with a faster time.





//----------------



//------- The results:

Time without Incrementation : 15 ms

Time with Incrementation: 156 ms


My objective is to minimize as possible the time of incrementation process

(Time second test < Time first test * 2 )

because actually

Time second test (156 ms) = Time first test (15 ms )* 10

I notes that i can added a new element in any position, but i chose the worst case (adding an element in the first position that requires the incrementation of all **x** element of the arraylist)

I tried many data structure as vector, hashmap ,... but I could not minimize the time of incrementation
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Duplicate of http://www.coderanch.com/t/610939/Performance/java/add-increment-array-elements.

Locking.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: adding and incrementing data structure elements simultaneously with a faster time possible
 
Similar Threads
array doubt
comparing time performance: Array vs LinkedList vs ArrayList
Challenge: Optimum way to randomize 1,000,000 numbers
add and increment array elements performance
Identical Arrays