aspose file tools*
The moose likes Performance and the fly likes Performance between Array list and StringBuffer to store Large amount of data? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Performance between Array list and StringBuffer to store Large amount of data?" Watch "Performance between Array list and StringBuffer to store Large amount of data?" New topic
Author

Performance between Array list and StringBuffer to store Large amount of data?

Gopi Nash
Greenhorn

Joined: Sep 26, 2011
Posts: 14


Hi all,

i am supposed to send the specific huge data to another class as parameter.
That Input Parameter in second class is necessary to make iterate in Resultset to get specific data.

can i send the parameter as StringBuffer or Array list.

When i send as StringBuffer It might be blocks of strings like

((a,b,c) in ((1,...),(...),(...),............(n,...)) if it is large data means it might be like long and takes more time to search any data.

When i send as stringbuffer, i have to split the string buffer using StringTokenizer .
But it got failed due to usage of special characters(comma,=)

which is best for handling huge amount of data.........
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18992
    
    8

You've already found out that using a StringBuffer is a big headache from the programming point of view, whereas an ArrayList is not a problem at all. So there's your answer: ArrayList is better.

I'm not answering your question about performance because (a) it's the wrong question to ask at this point, and (b) it's a bad question because you haven't said what kind of "performance" you were thinking of.
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

From a class/methods point of view, it is no difference if you send a REFERENCE to a StringBuffer object or a REFERENCE to an ArrayList. If you would draw it on a paper, the line connecting your class with the instance of the StringBuffer or the ArrayList is the same.

When sending large amounts of data to a class, it should be done in a structured way. What is in the array that you are going to send?
Gopi Nash
Greenhorn

Joined: Sep 26, 2011
Posts: 14

Ove Lindström wrote:From a class/methods point of view, it is no difference if you send a REFERENCE to a StringBuffer object or a REFERENCE to an ArrayList. If you would draw it on a paper, the line connecting your class with the instance of the StringBuffer or the ArrayList is the same.

When sending large amounts of data to a class, it should be done in a structured way. What is in the array that you are going to send?


(HeaderString,Timestamp,String,String)

Three values for specific HeaderString value, it will be send using ProcessInfo and Worker class

Destination class will have Header string value and search in Incoming Parameter value via Resultset
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

Gopi Nash wrote:
Ove Lindström wrote:From a class/methods point of view, it is no difference if you send a REFERENCE to a StringBuffer object or a REFERENCE to an ArrayList. If you would draw it on a paper, the line connecting your class with the instance of the StringBuffer or the ArrayList is the same.

When sending large amounts of data to a class, it should be done in a structured way. What is in the array that you are going to send?


(HeaderString,Timestamp,String,String)

Three values for specific HeaderString value, it will be send using ProcessInfo and Worker class

Destination class will have Header string value and search in Incoming Parameter value via Resultset


So, if I get you right, you want to pack four (4) different values into an Array to sent do a method? I think I am missing something here...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Performance between Array list and StringBuffer to store Large amount of data?