Clear() vs. removeAll() for an ArrayList

What's the difference between clear() and removeAll() for an ArrayList?
Does one actually garbage collect the memory? Is one better for synchronized situations?
From the documentation it's not clear how they differ except that removeAll uses an iterator and clear() doesn't give details.
Anyone have a link to more info?
Thanks!

I do not find a removeAll() method in ArrayList!
I find a method removeAll(Collection c)
it takes a Collection as a parameter.
here is it's specification
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collection.html#removeAll(java.util.Collection)
when you call this method on an ArrayList, it takes the Collection passed as a parameter and if an element in the passed collection exists in the ArrayList then the element is removed.
The clear() method is specified here
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collection.html#clear()
I think it's purpose is "clear" (pun intended)
sincerely
Walken16

Similar Messages

  • Findind Cleared open items for G/L account master (company code)

    Hi All,
        I wanted to incorporate one logic to find the whether open items have been cleared or not for G/L account master (company code).
    Currently, I am fetching the data from SKB1 based on company code.
    Then i am passing the GL account to BSIS table to find the whether all the accounts have been cleared or not.
    Is this the correct procudure or any other procedure to find the GL account is been cleared for open items.
    Is there any Function modules to find this any way.

    Thnkx.
    I am writting a report where i need to check the above scenario.
    Earlier we planed to call FBL3N to check the same, but
    But i need to call FBL3N in my report program. Which is not correct procedure
    Hence we taught to take all GL accounts from SKB1 and pass it to BSIS table and check.
    Is there any other way rather than the above one.

  • How system will automatically populate clearing date field for invoices paid similar to when payments are made to the vendors

    Hi SAP Gurus,
    Could you help me on this, How system will automatically populate clearing date field for invoices paid similar to when payments are made to the vendors.
    Regards
    Mohan

    Hi Ramakrishnappa,
    If you clear the invoice against payment, then the invoice clearing date would be payment document posting date.
    Regards,
    Mukthar

  • If I want to create a Listbox to run multple tests, how can I create a check all and clear all button for selection/​deselectio​n of all the tests

    create check all/clear all button for listbox

    Hi Arien,
    Parthabe is right, next time, try to create a new thread.
    So when others try to search for a topic, they can actually find it.
    I developed this example code that you can take a look at.
    It's using property nodes of the chart to control which plot to show and to force invisible
    Message Edited by Van_L on 03-06-2008 07:19 PM
    Van L
    NI Applications Engineer
    Attachments:
    choose plot.vi ‏25 KB

  • HELP!! How to clear my 700wx for resale?

    Hello, I would like to know how to clear my phone for resale, I erased all the text msg and the emails but would like to know if that info is stored on the phone somewhare else. Also If I use the reset botton will that clear the phone as well? Thanks Rob
    Post relates to: Treo 700wx (Sprint)
    This question was solved.
    View Solution.

    You need to perform an RTN reset. To do this, you will need the MSL code for this device. You should be able to obtain this from your carrier by calling them. However, if they will not provide it to you, you will have to take the device to one of their service stores and ask to have an RTN reset performed.
    To do this yourself if you have your MSL code:
    1) From the today screen dial  ##786#.
    2) Choose Options.
    3) Enter the MSL code.
    Post relates to: Treo 800w (Sprint)

  • Clear historical cache for particular field

    Hi all,
    I am working on a module pool program. There is one field to display the exployee number, let's say the field length is 8 char.
    Everytime accessing into the screen, the employee number field should clear (clear from history) for the next new employee to enter the employee number.
    The problem I am facing now is, the next employee can easily press on the SPACEBAR to select the employee number from the history (which is not agreed by my boss).
    I also understand that there is a fastest way to handle this by increasing the field length to longer, let's say 60 char. Then it will not display out in list for them to select from history even they press on SPACEBAR.
    In ABAP programming, how do I remove it from history for this particular field? Other fields are required to store in history for easier data entry.
    Thanks in advance.

    Hi,
    For each user related information is stored in the local folder. You can get the latest cache file for that user from there. Below is the path to obtain the same.
    C:\Documents and Settings\andy\SapWorkDir\SAP_Cache_andy
    Here you will find a lot of files. They will contain the latest cache information.
    Cache1 and Cache2. You need to manipulate these files to achieve the requirement.
    Thanks,
    Samantak.

  • SIT Clearing A/c for STO

    Dear Experts ,
    Following scenario is expected to happen between 2 plants under 1 company code.
    PO to be raised by receiving plant
    PO Mat. Code --STB
    PO Qty--100
    Freight Condition --     2%
    Octroi Condition --     2 % Octroi and Entry Tax Condition both would not be applicable at the same time
    Entry Tax Condition-- 0 %
    STO to be rasied by Sending Plant
    STO Mat Code ---      STB
    STO Quantity  --      100
    Sending Quantity      100
    *Sending Palnt transfers the 100 Qty of STB - Entry Would be*
    SIT Clearing A/c Dr.     --     155000
    To Inventory STB A/c       --     155000
    Receiving Plant received the 100 Qty of STB - Entry would be
    Inventory STB A/c Dr. (15500031003100)  --- 161200
    To SIT Clearing A/c                -- 155000
    To Freight Clearing / Payable A/c     -- 3100
    To Octroi Clearing / Payable A/c          -- 3100
    Please confirm, can we create such clearing a/c for material in transit ( STO scenario )
    Thanks ,
    Pradeep

    Hi ,
    Thanks for the response ,
    We agree about  the PGI accounting entries & no such entries in SIT ,But as per requirement of business scenario , we need above SIT clearing A/c during STO.
    Kindly confirm possibilities for the same.
    Thanks,
    Pradeep

  • Making buttons for an ArrayList

    I am in a hurry as this program has to be handed in tomorrow so quick replys would be helpful.
    I dont know how to make buttons in my GUI for an ArrayList and have it respond individualy with the name of the button i.e. i want to make it so that when you click on the drill button it will get take the label of that button and return it as a string. The problem is making the individual buttons that will respond to individual commands.
    Im pretty sure that made no sense but im out of ideas.

    Disregard the previos post i was doing it wrong.
    Ive realised that the main problem is that is ignoring this
    else if (event.getSource() == y)
                    String text = ((JButton)event.getSource()).getText();
                    game.playGUI("grab "+ text);
                    frame.dispose();
                    makeFrame();
                }

  • How do i clear java caches for Mac OS X, version 10.6.8?

    how do i clear java caches for Mac OS X, version 10.6.8?

    Sarah2565 wrote:
    should i keep the "keep temp files" box checked after removing Java caches?
    Yes. Always keep the default settings unless you have a specific reason not to.
    If you are a heavy user of Java programs or applets, you may need to clear the cache files after Java updates because the old caches may interfere.

  • I want to clear the values for the controls

    Hi all,
            After Adding Process, i want to clear the values for the controls in the form.
    Any one help me.

    If you use 2005, you can use the Formdata Event and catch the FORM_DATA_ADD event... In there you can clear the data

  • Phone won't see media files after clearing the data for SomcPhotoAnalyzer.apk

    Hello,My sister accidentally cleared the data for the PhotoAnalyzerService app (com.sonymobile.photoanalyzer 5.5.A.0.10) in the app manager on her Z2. That caused the Album app to disappear from the app drawr. Since then, she updated Album (com.sonyericsson.album) from the Play Store, and that caused the Album  icon to reappear in the app drawr. However, something is wrong with how media is handled by the phone now: Album now behaves like this:In Home: all photos inside the DCIM folder, BUT photos that were downloaded to the phone are missin.In Camera: only camera photos taken after the data was cleared.In Folders: shows nothing.When trying to edit an older camera photo it says "no application available."Additionally, all ringtones were rest to default, and selecting new ones is now impossible, either with Sound Picker or with ES File Explorer. Restarting the phone many times didn't help. The phone is running android 4.4.2 (Build 17.1.2.A.0.314). Any advice? Will a factory reset help? Anything other than a factory reset? (she won't be happy to lose everything on the phone...)  Edit: to be clear, the files that are missing from Album are still on the phone, and can be viewed with ES File Explorer, for example.

    You could try an app preferences reset Settings tap the 3 dots or options icon then Reset app preferences and then reboot and test - As for apps missing then try Settings then Apps then swipe to disabled to see if the app in question is there however if files are missing it could be that all data for that app was erased at the same time

  • Deleting/clearing chat history for one single cont...

    I want to delete/clear chat history for one single contact!
    I want to see this option with the next update! I also do not want the complicated 3rd party solutions!
    What's the reason of not providing this easy thing for so many years? 
    You are not the one! I'll switch to Viber, if you insist on this!!!
    The real pain is having no clever solutions for the paid-service you own.

    Weird, so after clearing the cache a url using ajax
    like this works
    http://www.abc.com/?a=b
    and this does not
    http://www.abc.com/
    Unfortunately, since each application running its own server will handle pages differently and have backend scripts that process the requests, there is not a whole lot we can do in the browser but clear the cache. It would require resources beyond this forum. If however, you can get in contact with the developer of that application and ask if this is expected, we would be happy to work with an example.
    Please let us know how you would like to move forward with the investigation.Or if you would like to investigate further you can try the fake item in this add on to view the HTTP header in more detail (plain text as well): [https://addons.mozilla.org/en-US/firefox/addon/http-resource-test/]
    Please let us know if this helps.

  • Clear  Single  Payment for Two Invoices

    Hi All,
    I am working on lock box file.where iam geting the payment information of customer.File contains record type as '1'  '2'  '5'  '6'  '4'  '7'  '8' '9' .They already developed a program based on standard programs like :
      RFEBLB00    Import Lockbox File
      RFEBLB20    Lockbox: BAI Format Processing
      RFEBLB00    Main Lockbox Program
      RFEBBU01    Post Temporary Storage Data Call
      RFEBBU00    Update Account Statement/Check Deposit Transaction
    that program working for Single Payment for Single Invoice.It clear the invoice for Single Payment for Single Invoice.But when they are trying to run for  Single  Payment for Two Invoices then its not posting.How can i clear the  Single  Payment for Two Invoices .Is possible to clear the  Single  Payment for Two Invoices .Please do need ful help ASAP.
    Thanks

    If the lockbox file being processed by RFEBLB00 has more than one invoices for a single check (i.e. multiple type '4' records for a type '6' record), the payment doc created will be for both these invoices.
    Now when you clear the payment doc using FBRA or F.80, both these invoices will be cleared.

  • How to mantain or clear the changelog for meta-directory 5.0?

    Hi,
    We are using the Meta-Directory 5.0 now. But we are suffering from the
    changelog maintenance.
    Anybody know how to maintain or clear the changelog for Meta-Directory
    5.0?
    Or any document about this.
    Thanks for your advice.
    Best Regards,
    Sunny Yeh

    Hi Raj,
    You can use below URL for your query;
    http://docs.oracle.com/cd/E21764_01/bi.1111/e10541/cluster.htm#BGBHFCJF
    If it helps, please update the post.
    Regards,
    Kashi

  • HT4972 ipad software update. If I clear up storage for update, will I gain it back after download?

    ipad software update. 
    I have tried updating Ipad through my older Mac in  ITunes.  When I click "Update", it gives a box that says "This version of ITunes (10.6.3) is the current version.
    If I want to update it through wireless, I do not have enough storage.  If I delete enough apps to  clear up storage for update, will I gain it back after download?

    How much space is used by your Other? You may be able to reduce.
    How Do I Get Rid Of The “Other” Data Stored On My iPad Or iPhone?
    http://tinyurl.com/85w6xwn
    How to Remove “Other” Data from iPhone, iPad and iPod Touch
    http://www.igeeksblog.com/how-to-remove-other-data-from-iphone/
    With an iOS device, the “Other” space in iTunes is used to store things like documents, settings, caches, and a few other important items. If you sync lots of documents to apps like GoodReader, DropCopy, or anything else that reads external files, your storage use can skyrocket. With iOS 5/6/7, you can see exactly which applications are taking up the most space. Just head to Settings > General > Usage, and tap the button labeled Show All Apps. The storage section will show you the app and how much storage space it is taking up. Tap on the app name to get a description of the additional storage space being used by the app’s documents and data. You can remove the storage-hogging application and all of its data directly from this screen, or manually remove the data by opening the app. Some applications, especially those designed by Apple, will allow you to remove stored data by swiping from left to right on the item to reveal a Delete button.
    What is “Other” and What Can I Do About It?
    https://discussions.apple.com/docs/DOC-5142
    iPhone or iPad Ran Out of Storage Space? Here’s How to Make Space Available Quickly
    http://osxdaily.com/2012/06/02/iphone-ipad-ran-out-of-available-storage-space-ho w-to-fix-quick/
    6 Tips to Free Up Tons of Storage Space on iPad, iPhone, and iPod Touch
    http://osxdaily.com/2012/04/24/6-tips-free-up-storage-space-ipad-iphone-ipod-tou ch/
    Also,
    How to Clear Message/iMessage Cache on iPhone & iPad And Reclaim Lots of Free Space
    http://www.igeeksblog.com/how-to-clear-message-imessage-cache-on-iphone-ipad/
     Cheers, Tom

Maybe you are looking for