ToString() and new String(),which is the better?

now,there is very big StringBuffer sb,i want convert it to String s,which is the better:
s=sb.toString();
s=new String(sb);
Thanks.

now,there is very big StringBuffer sb,i want convert
it to String s,which is the better:
s=sb.toString();
s=new String(sb);
Thanks.this is the implementation advice for
toString(StringBuffer)
This method can be coded so as to create a new String object
without allocating new memory to hold a copy of the character sequence. Instead, the string
can share the memory used by the string buffer. Any subsequent operation that alters the
content or capacity of the string buffer must then make a copy of the internal buffer at that
time. This strategy is effective for reducing the amount of memory allocated by a string
concatenation operation when it is implemented using a string buffer.
so decide urself
regards
robert

Similar Messages

  • CSM Redundancy : FT or HSRP +FT .. Which is the better option?

    Hi,
    I would like to know for redundancy between CSMs which is the better option FT or HSRP with FT.. and why ?
    Regards
    Kas

    The CSM does not run HSRP.
    So your only option is FT failover.
    Gilles.

  • Which is the better processor?

    Hi, I've been looking at different cpu benchmarks but some are saying different things. Which is the better processor adobe premiere pro and after effects cs6? Intel core i5 3210M or AMD A8 4500M?

    The best benchmark site for Premiere Pro is http://ppbm5.com/
    If you are going to edit HiDef you need an i7 or for standard def video at least an i5
    The AMD lacks some of the special firmware instructions that PPro uses, so will always be slower than Intel
    If you are looking at a laptop, read http://forums.adobe.com/thread/1069742
    -and http://forums.adobe.com/message/4578948

  • Null and empty string not being the same in object?

    Hello,
    I know that null and empty string are interpreted the same in oracle.
    However I discovered the strange behaviour concerning user defined objects:
    create or replace
    TYPE object AS OBJECT (
    value VARCHAR2(2000)
    declare
    xml xmltype;
    obj object;
    begin
    obj := object('abcd');
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := '';
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := null;
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    end;
    When creating xml from object, all not-null fields are transformed into xml tag.
    I supposed that obj.value being either '' or null will lead to the same result.
    However this is output from Oracle 9i:
    <OBJECT_ID><VALUE>abcd</VALUE></OBJECT_ID>
    <OBJECT_ID><VALUE></VALUE></OBJECT_ID>
    <OBJECT_ID/>
    Oracle 10g behaves as expected:
    <OBJECT><VALUE>abcd</VALUE></OBJECT>
    <OBJECT/>
    <OBJECT/>
    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?

    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?A lot of "fixes" were done, relating to XML in 10g and the XML functionality of 9i was known to be buggy.
    I think you can safely assume that null and empty strings are treated the same by Oracle regardless. If you're using anything less than 10g, it's not supported any more anyway, so upgrade. Don't rely on any assumptions that may appear due to bugs.

  • I want to relocate my iTunes library on a NAS drive and stream to apple tv2 and DLNA tbs around the house is this possible and if so which is the best NAS drive to buy???

    I want to relocate my iTunes library on a NAS drive and stream to apple tv2 and DLNA tbs around the house is this possible and if so which is the best NAS drive to buy???

    ged2001 wrote:
    I want to relocate my iTunes library on a NAS drive and stream to apple tv2 and DLNA TV's around the house is this possible and if so which is the best NAS drive to buy???
    i don't have any experience with DLNA TV's but i recently moved my iTunes library to a NAS. streaming content to airport express remote speakers and TV2 works great. however, i have all my gear hardwired to my time capsule (except the airport express) so i'm not sure how well streaming e.g. HD movies to TV over wifi works.
    i have a Synology DiskStation 411j and am very happy with it.

  • My phone has been changed under warranty by the apple store in germany. ı need a change document to register the phone in my country again. ımeı numbers of old and new must be in the document.you can send an mail in pdf format as soon as possible please.

    my phone has been changed under warranty by the apple store in germany.
    ı need a change document to register the phone in my country again.
    ımeı numbers of old and new must be in the document.you can send an mail in pdf format
    as soon as possible please.
    your's respectfully.
    new phone serial no:DQ******TC0
    old phone serial no:DN*******T9Y
    Product:
    iPhone 4S
    Serial Number:
    DN*******T9Y
    Service Requested:
    December 3, 2012
    Status:
    Repair Complete
    <Edited by Host>

    No we cannot send it to you because we are users just like you and Apple does not monitor these forums.
    But you can find the IMEI numbers yourself. Read the ENTIRE article:
    http://support.apple.com/kb/HT4061

  • "Freeze/Unfreeze" and "New View" buttons of the Structure window are gone

    Hello everyone!
    I'm using jDev 11.1.2.1.0 and for quite some time now I realized the "Freeze/Unfreeze" and "New View" buttons of the Structure window are gone.
    Have they moved or hide somewhere else, or they are gone for good?
    Thanks a lot
    ~apostolos

    Looks like this has been intentionally done
    Eliminate Freeze & New View (also in PI). These options were confusing users and for those who understood them found them not very usefulCourtesy - http://www.oracle.com/technetwork/developer-tools/jdev/jdev-11gr2-nf-404365.html.
    I'm not really sure though what you need to do if you actually need those features

  • Which is the better low-cost 24" Alum refurb'd iMac and why?

    OK, I admit I don't pay enough attention. I have a couple year old 24" White iMac with 2.4GHz processor and 500Gb drive, and I'm thinking of "upgrading" to an Alum iMac for no particular reason. So I've been looking at the refurbs in the Apple store. Right now I've got a choice between
    1) 2.66GHz, 4G, 640G HD, Nvidia GEForce 9400 w/256 for $1299, and
    2) 2.93GHz, 4G, 640G HD, NVIDIA GeForce GT 120 with 256MB memory for 1549, and
    3) 3.06GHz, 2G, 500G HD, NVIDIA GeForce 8800 GS with 512MB memory for 1599,
    all more or less in budget. Are there significant differences and are they mostly to do with the vid card?
    Any opinions? Buy the most expensive one you can afford? There used to be an older 2.8GHz model that many said was better than the 2.66GHz model here, so are there sig differences? Sould I just keep the white one for the present and wait?
    Mired in Doubt

    Pier Rodelon wrote:
    One poster remarked that the 2.8 GHz model unlikely to be noticeably faster than my present 2.4GHz with 3G ram. If that also holds true for the 2.93 and 3.06 I might just sit still and wait a bit, since my machine has operated flawlessly since I bought it on eBay 2 years ago.
    As a side-question, what is the projected schedule of new iMac releases, and where can I find a history of all releases?
    Again, many thanks for the help.
    All the choices you refer to, including the 2.8 GHz that I mentioned, won't have significant speed differences. You already have an Intel Core 2 Duo processor, and the difference between 2.4, 2.6, 2.8, 2.9, and 3.06 is only an issue of seconds, not minutes. If you were moving up from PowerPC to Intel, then yes, a new Mac would provide a huge increase in speed.
    If you want to know the history of all Macs, download the free Mactracker program.
    http://mactracker.dreamhosters.com/
    It provides details of every Mac model made, including the introduction and discontinue dates. Macs lasted a lot longer in the old days: Mac IIci introduced September 1989 and discontinued February 1993. The shortest lived Mac would be the original Power Mac G4 from August 1999 to October 1999. The iMacs have typically run the course of a year before a new model is released. Complete design changes have been around a two to four year period, or sometimes longer.

  • Which is the better option?

    Hey, I'm looking at getting a new mac but I'm not sure what's the better option. My choice right now is between the base 21.5 inch iMac or the Mac mini ( $799 model), and my main use for it would be recording instruments, music production, and movies / netflix. The 21.5 inch Mac would only give me 8gb of ram, whereas the Mac mini I'd instantly be able to upgrade to 16gb. Another bonus to the mac mini is that I can hook it up to whatever screen I want including my TV for movies.Also, the firewire on the mac mini would be extremely useful as some of the higher quality recording interfaces use firewire. And from what I understand I can also add a SSD to the mac mini? For these reasons I'm leaning towards the Mac mini but I've been recommended by representatives at apple to get the iMac as it's more powerful supposedly, so I'm not sure which one would be better. I know the iMac has a dedicated graphics card vs the integrated hd 4000 on the Mac mini, but I'm not exactly sure how that affects me for what I plan on using the computer for. I'd have to buy a monitor and mouse + keyboard for the mac mini, so it ends up costing me the same as the base model iMac. Any suggestions/ opinions would be appreciated, thanks.

    I would recommend getting the 16GB iMac. If money is an issue then consider using Apples refurbished store, there is no downside to buying from it as they sell current machine, the products have the same warranty as a new machine, and are eligible for AppleCare.
    Because you did not compelete a profile we have no idea where on the planet you are located. To find the US refurb store click:
    http://store.apple.com/us/browse/home/specialdeals

  • Which is the better iTouch size?

    New here and I'm trying to decide which iTouch to buy my wife.  I have been going back in forth between the 32GB http://amzn.to/wgM5BX and the 64GB http://amzn.to/zzTs2U
    She listens to books and music and I image will get into a few games and apps.  She will also probably want to have some pictures of our kids on there too.  I usually thought you should buy the bigger size to future proof the purchase, but now I hear you can stream your music and other stuff, so maybe the hard disk size isn't as relevant.  Can anyone give me some feedback on what size to get a medium user of an itouch?  Am I making a mistake and should I be looking at the 8GB?

    Personally I think that 6gb is too small even for a medium user which is the available memory for the 8gb ipod touch. When it comes to memory the bigger the better, lol. I would suggest the 32gb model. 6 gigs won't be enough for music, games and apps. Think also about her music collection, 1,000 songs at 128kbps take about 3-4 gigs of memory and the majority of games use about 100mb of memory. If you are planning on streaming the content then you can get the 8gb version but then that will limit the music playing to just your home or if you go to someone's home you will only have access to their music library.

  • Which is the better upgrade: EOS 5DS R or EF 400mm f/4 DO IS II USM?

    I have the 5D Mark II with a 100-400 mm lens (the old version). As a wildlife photographer, which would be the better upgrade, the EOS 5DS R or EF 400mm f/4 DO IS II USM?

    I always assumed lens upgrade first. In this case I was impressed by the new features of the 5DS R because I photograph small birds, often in trees, often at a distance of 30-50 feet, and almost always moving around. I thought the 61 point high density reticular AF might be quick enough to get a photo (that my current set up can't get) and with a file that would allow severe cropping which would make up for the distance.
    On the other hand, photographing birds in riparian areas where there is usually poor lighting might suggest the better lens is the answer. 
    That's basically why I thought to ask others.

  • Same algorithm in function and procedure then which one will better?

    Why pl sql function is better to computes a value instead of procedure?
    If I apply same algorithm in function and procedure then which one will perform better?

    It's not a matter of performance, it is more a matter of how it is going to be used.
    A function can be used as an expression in an assignment or in a query.
    my_var := my_func(my_param);
    select my_var(my_col) from my_table;But it can just return a single value (which can be a complex value like a nested table or object or ref cursor, but still a single value.)
    The procedure often is more used to perform an action that does not return anything.
    execute_invoicing(my_invoice_id);Or procedures can be used if you need multiple return values.
    my_proc(my_input, my_output_1, my_output_2, my_output_3);But the procedure cannot be used in an assignment expression or a select query.
    Performance wise procedures and functions are completely identical. It is only a matter of what action they perform and how you are going to use them.

  • Which is the better app for devloping a freelance design website?

    Hey Forum
    I'm putting together a website for my freelance design business. I've rough out the site, but now I'm stuck between using Dreamweaver or Flash. The site is relatively simple with the common home, about, philosophy portfolio and contact pages. I know that Dreamweaver is a real workhorse and is very stable. But as a designer I want a little more glitz and freedom which Flash seems to have. If I do use Flash, I'm worried about bandwidth, search capabilities and device compatibilities.
    Any insight would very helpful
    KatyDad

    The stability of Dreamweavere will have no little bearing on the stability of your web site--Dreamweaver provides tools, it doesn't teach you how/when to use them.  Your decision on which way to go should be based on what it is you are trying to sell.  If you are selling web site design, then you may want to temper things towards a non-Flash design base so that you can demonstrate your coding skills alongside the graphics aspects of it.  If you are selling Flash-based designs, then Flash would be a good vehicle to demo the work itself.  If Flash is not a big part of what you are selling, then it should not be a big part of what you put on display.  But you can always mix things up, showing Flash elements and html/css elements, if the intention is to show well-rounded skills across the design options palette.
    Be prepared for a large swing in differences in the responses.

  • Just bought imac5.1 and needing os. which is the best for this model? only 2gb of ram

    Just bought imac 5.1 2gb ram need os which is the best to run?

    Here are the specs for your machine:
    http://www.everymac.com/systems/apple/imac/specs/imac-core-2-duo-2.16-20-inch-sp ecs.html
    I'd suggest purchasing a retail Snow leopard disk at the Apple store; it is a very stable system and will run well on 2 GB RAM.
    http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard

  • Add 2 strings which represent the total time

    Hi,
    I have a column which stores the total duration of a session. I am retriving it as String, but I need to total the entire column. How can I achieve that. I am storing it in (hh:mm:SS) format.
    Please do share your inputs.
    Thanks,
    Ajay.

    Convert hh:mm:ss to seconds by StringTokenizer with delimiter :
    Convert hh, mm, ss to int by parseInt();
    total = 360*first + 60*second + third;

Maybe you are looking for

  • Movies I have purchased through Itunes show up on my computer, but do not show up on Apple TV

    Latley I have notices that movies in my Itunes library are "missing" from my apple TV's.  I have checked under get info "type", checked show in windows explorer, but certain movies just are not in the purchased catagory on the apple tv.

  • Field Value in ME51N Transaction

    Hi Gurus. I need assign from EBAN table one value, to field value in Item 'Valuation'  (tabstrip vauation) in the data of the position. Is this possible ?? Thank You for yours helps.

  • Show/Hide behaviour not working in Safari

    Generic show/hide layer behaviour to show large images on mouseover of thumbs... it doesn't work in Safari I'm told - only page that's live http://www.dreamweaverresources.com/studio1/places.html any ideas as to why this wouldn't work in that browser

  • 2nd screen not recognised after reconnecting to Macbook Pro

    I've got a Macbook Pro at work. It's connected to a 2nd monitor via HDMI cable, but I have to unplug the laptop and take it to meetings sometimes. Since upgraded to Maversicks, the laptop doesn't recognise the 2nd screen when the laptop is reconnecte

  • How to render a Custom LOV Pop Up  with its first Row selected

    Hi All, I have a requirement in my Custom LOV , I want to render my custom LOV with Query panel and resulset table in such way, where the first row is selected and the users are able to use the KEY Up and Down Arrows and Enter key to select it. Curre