Results 1 to 3 of 3
  1. #1
    miu44 is offline Member
    Join Date
    Dec 2010
    Posts
    6
    Rep Power
    0

    Default can someone suggest me how to sort data..?

    Hi everyone,
    I have this time-output data like this in txt data type..
    XML Code:
    time,output
    0.6,20.0
    1.0,40.0
    0.8,20.0
    and i want to sort it out by every row in the next time data is the sum of all the previous time data,like this..

    XML Code:
    0.6,20.0
    1.6,40.0
    2.4,20.0
    i tried to use TreeMap by recklessly adding another column before the time column and sorting it with A to Z,hoping it will update with the natural order ABC but it doesnt work well. Can anyone suggest me something because i kinda use all of my ideas right now..

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    You are not doing any sorting, whatsoever. Use a simple arraylist and perform the "+" before adding to the list (either by "maintaining" the previous sum, or by first retreiving the last item in the list).

  3. #3
    miu44 is offline Member
    Join Date
    Dec 2010
    Posts
    6
    Rep Power
    0

Similar Threads

  1. Replies: 6
    Last Post: 12-01-2010, 05:31 AM
  2. Using Merge Sort to sort an ArrayList of Strings
    By coldfire in forum New To Java
    Replies: 3
    Last Post: 03-13-2009, 01:03 AM
  3. Please suggest me the correct approach!
    By rjuyal in forum Advanced Java
    Replies: 6
    Last Post: 05-05-2008, 02:54 PM
  4. How to sort a list using Bubble sort algorithm
    By Java Tip in forum Algorithms
    Replies: 3
    Last Post: 04-29-2008, 08:04 PM
  5. Please suggest a database ?
    By Vinuraj in forum CLDC and MIDP
    Replies: 1
    Last Post: 01-14-2008, 08:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •