RemoveAll doesn't remove all elements

Hey All,
I'm having an issue with removeAll not removing all the element every time. Sometimes it does, and sometimes it seems to miss one or two.
I am holding a number of Message objects in a TreeSet, and have other TreeSet's that also contain Message object's.
     messages.removeAll(c.getMessageList());
Basically what i have is a message list for each "channel", and an object that can hold the messages of multiple channels in it, so when that channel is enabled, i add the messages from the specific channel, and remove them when they are disabled.
The issue is that some seem to linger sometimes, but then i can play with it for a while, disabling and reenabling the channel, and it will remove the message after a couple tries. I debugged it, and saw that the list i was removing did contain the same object i was removing from, but it didnt remove it.
This is probably really confusing, so please let me know what i need to clarify.
THanks,
Philippe

The weird thing is that the 2 it didnt remove were in the middle of the set. If it was synchronization issues, i'd expect it to be at the end.It's a red-black-tree (balanced), so it makes a some sense. But I'd still expect a call to removeAll() to reset the internal state completely by replacing the root node.
EDIT: I should really be reading the posts completely.. I was thinking about clear(), sorry :d
PS. would it be just as efficent to just recreate the Overall or container set every time, instead of just removing the ones that are no longer enabled, cause that would fix the problem also.Well, marginally less efficient, but generally you don't have the possibility to replace the set whereever it is referenced..
With kind regards
Ben
Edited by: BenSchulz on Feb 15, 2008 10:13 PM

Similar Messages

  • Removed all elements of itunes and still can't rid of icudt49.dll?Please help

    I have removed all elements of itunes and still can't get rid of icudt49.dll? please help

    See Troubleshooting issues with iTunes for Windows updates.
    tt2

  • Diagram Disable Structure doesn't remove all objects it contains after deleting the structure.

    I have programmed in side of a while loop a Stop from "Application Control", later I used disable structure around that "Stop". It was working fine, but after removing disabled structure containing the disabled "Stop" my application stops even there was no reason to stop. Later I have experienced that removing the disabled structure leaves hidden object in the code and some how they get executed and it is no way debugging due the objects are invisible.
    I am worried that this is a bug in Labview !
    (Edi)
    Solved!
    Go to Solution.

    The Stop was in the disabled case in a frame and after removing the complete "disable structure" the software stopped randomly at the location where the disabled structure containing the Stop was already removed. Unfortunatally the code is to complex to post. I am working on a demo, but sofar doesn't prove my point yet. But I realized Labview was pointing on left over items from the disabled structure after its removal. The compiler was high lighten the hidden objects in the same shape of the object but without any visible object in the high lighted position in the graph. 
    (Edi)

  • Empty Cache doesn't remove all files

    can't quite find the answer i'm looking for with a google or forum search - perhaps someone can help.
    I want to get rid of my entire internet browsing history. I've reset Safari and emptied the cache numerous times, but files relating to old searches keep appearing, but in strange places.
    For example, I was doing research for "company X" a while back. After the project completed, I emptied the cache, etc. Doing a mac search (cmd F) for anything related returns no files. However, when I'm using another, unrelated application, say, Photoshop, I'll go to import a file. In the import dialogue box there, if i type anything related to that previous "company X" search, it will appear as a Safari file (along with other files), though it is grayed out and unable to be selected.
    So, because these files show up in that import dialogue box, they have to be somewhere on my system, correct? But because i can't find them using Cmd F, and i've already emptied Safari caches, etc, I'm at a loss as to where to find these files and how to get rid of them.
    Any thoughts would be appreciated. Thanks!

    Hi,
    You can activate Private Browsing from the Safari menu. Safari won't remember pages you visit, search history, or autofill.
    Carolyn

  • Removing vector elements

    hi there
    i have a vector, that has the contents of a directory as elements. in the post proccessing phase i trie to remove all elements that are .java files or are class files that end with Options.class or Options$1.class.
    i use this code
    for(int i=0; i < plugins.size(); i++) {
       theFilename = plugins.elementAt(i).toString();
       System.out.println("TheFilename: "+theFilename);
       if(theFilename.endsWith(".java") ||
          theFilename.endsWith("Options.class") ||
          theFilename.endsWith("Options$1.class")) {
            System.out.println("Removed: "+theFilename);
               plugins.remove(theFilename);
    }the problem is, that that code always leaves one element in the vector, that should be sorted out by this loop. anyone an idea ?
    - rebel

    Hi jaylogan again,
    i read your second answer. I use the methods of the file-class. So it seems better to paste the whole method in here. note, the for loop, that removes filenames is twice there. after first test i found ou, that the second loop is removing the last filename that should not be in the list. that worked as long i had only one plugin in the plugin directory. when i added a second plugin the double for-loop was not working anymore. there is still an element left that should not be in the list.
    sourcecode:
    public void createPluginList() {
              String theFilename;
              String plugInDir = getCurrDir()+File.separator+"plugins";
              File dir = new File(plugInDir);
              FilenameFilter filter = new FilenameFilter() {
                   public boolean accept(File dir, String theName) {
                        return theName.startsWith("Pi");
             String[] contents = dir.list(filter);
             if (contents == null) {
                   // Either dir does not exist or is not a directory
              } else {
                   for (int i=0; i < contents.length; i++) {
                        plugins.addElement(contents);
              System.out.println("------------");
              for(int i=0; i<plugins.size(); i++) {
                   System.out.println(plugins.elementAt(i).toString());
              System.out.println("------------");
              for(int i=0; i < plugins.size(); i++) {
                   theFilename = plugins.elementAt(i).toString();
                   System.out.println("TheFilename: "+theFilename);
                   if(theFilename.endsWith(".java") ||
                   theFilename.endsWith("ptions.class") ||
                   theFilename.endsWith("ptions$1.class")) {
                        System.out.println("Removed: "+theFilename);
                             plugins.remove(theFilename);
              System.out.println("------------");
              for(int i=0; i < plugins.size(); i++) {          // I dont know why i have to run this
                   theFilename = plugins.elementAt(i).toString(); // a second time, but only then
                   System.out.println("TheFilename: "+theFilename); // it works
                   if(theFilename.endsWith(".java") ||
                   theFilename.endsWith("Options.class") ||
                   theFilename.endsWith("Options$1.class")) {
                             System.out.println("Removed: "+theFilename);
                             plugins.remove(theFilename);
              System.out.println("------------");
              for(int i=0; i<plugins.size(); i++) {
                   System.out.println(plugins.elementAt(i).toString());
    -rebel

  • I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

    I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

    I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

  • My father updated his iPhone and once he did that he would receive all of my texts and iMessages, is that because we are on the same iCloud account? And if that's why how can I remove it or make it so he doesn't get all my messages

    My father updated his iPhone and once he did that he would receive all of my texts and iMessages, is that because we are on the same iCloud account? And if that's why how can I remove it or make it so he doesn't get all my messages

    you can change the accounts of different apps in the phone's settings menu.

  • Trying to install final cut express keep getting error message "FCE" can't install on this disk.  A newer version of this software already exists on this disk.  Have remove all FCE elements with no success.

    Keep getting error message "FCE" can't install on this disk.  A newer version of this software already exists on this disk.  Have remove all FCE elements with no success.

    http://www.digitalrebellion.com/fcsremover/

  • Privacy - remove all website data doesn't work

    Hi all,
    when I choose privacy > remove all website data - it doesn't work and all the data remains.... (details says many are in cache)
    Q: why is this and how to I remove the data?

    A well known contributor here wrote the following ...
    Cookies have acquired a worse reputation than they deserve.   They cannot hold any executable code, they just hold data and then, only data the user has provided.   You could say they're as dangerous as you let them become.
    And that I think sums it up.    Clearing all website data is counter productive insofar as it removes many cookies that do a useful job and save you time.
    Just take care where you browse, use private browsing if you are unsure and that should be enough.   As an option, I bought an app called 'Cookie'. It's about £10 and I found it very good for a whole range of other cookies like databases and flash cookies.   Read about it at ...
    Download Cookie for Mac - Protect your online privacy. MacUpdate.com
    Thanks for the star. 

  • Should I remove all Premier Elements now that I have CS5?

    I have Photoshop Elements 9 & 11, Premier Elements 10 & 11. Also added CS5. Can I safely remove all the Elements programs and not lose photos?

    Hi,
    You can keep CS5 and PSE/PRE both together.
    Although regarding uninstallation : PSE/PRE is just a Databse of your photos. They resides orginally on your harddisk and PSE makes the links to them.
    Please refer the link to see the process: http://helpx.adobe.com/photoshop-elements/kb/uninstall-premiere-elements-photoshop-element s.html
    *In the article it says PRE content , which is an explicit content get installed along with PRE and its NOT the USER content (such as user images or videos).
    -Harshit yadav

  • I will give my Iphone 5 to my brother in Vietnam.  How do I remove all of my information so later he doesn't download any itune app and I don't want to get charged in my credit card?  Thank you.

    I will give my Iphone 5 to my brother in Vietnam.  How do I remove all of my information so later I don't get charged in my credit card?  He can download the app and pay his own money.  I don't want to get charged in my credit card in my Apple account.  Thank you.

    To wipe phone
    Turn off imessage in settings/messages
    Turn off Facetime in settings/Facetime
    Delete icloud account in settings/ilcoud
    Erase all data and settings in settings/general/reset
    Delete the phone from your profile in  https://supportprofile.apple.com

  • Safari 6.0.5 "Remove all website data" doesn't work

    Safari 6.0.5, OS X 10.8, MacBookPro 17" Mid-2010.
    I cannot properly remove the cookies from Safari. It takes 3, 4 or 5 relaunches to clear them all. Bug?
    I have even installed OS X 10.8 on a blank disk, from scratch. I have even repaired my boot disk permissions. The trouble is still there.
    This is what I do:
    I clear the cache with Command-Option-E.
    I select the menu "Safari:Reset Safari...", I mark all the check-boxes and press the OK button.
    I go to the Preferences:Privacy panel, and I clearly see "5 websites stored cookies or other data". Sometimes they are even hundreds.
    I click on the button "Details..." and verify they are all listed there. Yes they are.
    Now I click on the button "Remove all website data". It seems the data have been removed. No more messages aside the button.
    Then I quit and relaunch Safari, then I open the Preferences:Privacy panel.
    Well, I clearly still see "5 websites stored cookies or other data".
    So I click again on the button "Remove all website data". It seems the data have been removed. No more messages aside the button.
    Then I quit and relaunch Safari, then I open the Preferences:Privacy panel.
    Well, I clearly still see "2 websites stored cookies or other data". So only 3 data have been removed.
    Now I click on the button "Remove all website data". It properly shows the data have been removed.
    Then I quit and relaunch Safari, then I open the Preferences:Privacy panel.
    Finally, I see the data have been removed. But is that true? Is that reliable? Of course I don't trust that.
    So I quit Safari once again, relaunch it once again and verify that on the Preferences:Privacy panel.
    Finally I quit Safari (with still some doubt...).
    I guess that's not what I am supposed to do.

    A well known contributor here wrote the following ...
    Cookies have acquired a worse reputation than they deserve.   They cannot hold any executable code, they just hold data and then, only data the user has provided.   You could say they're as dangerous as you let them become.
    And that I think sums it up.    Clearing all website data is counter productive insofar as it removes many cookies that do a useful job and save you time.
    Just take care where you browse, use private browsing if you are unsure and that should be enough.   As an option, I bought an app called 'Cookie'. It's about £10 and I found it very good for a whole range of other cookies like databases and flash cookies.   Read about it at ...
    Download Cookie for Mac - Protect your online privacy. MacUpdate.com
    Thanks for the star. 

  • I cannot receive mail and the password is incorrect. I know my password, but it suddenly doesn't work anymore.I 'removed' all passwords. Still doesn't work.

    I am totally frustrated with Thunderbird. All I want to do is send and receive email, but I always run into problems. This time I cannot send or receive emails because the password is incorrect. I haven't changed my passwords so why is this happening? I removed all passwords to my emails and Thunderbird still asks me for my password. I enter in nothing or my old password and still nothing. Please advise.

    has your provider webmail? Try the passwort there. Maybe you have been locked out because you entered the wrong password too many times.
    Maybe you are using the wrong username.
    check if your e-mail provider has a step by step manual on how to setup an account with Thunderbird.

  • Why doesn't the Remove All cookies button , actualy remove any cookies?

    Tools, Options, Privacy, Cookies, Keep Until I Close Firefox is checked. Next choose the show cookies box. Next choose remove all cookies. All cookies remain. Tried removal one at a time and got the same result. All cookies remain. I made sure I had the latest Flash update and tried again. All cookies remain. If I can't clear cookies I can't use Firefox.

    Depending on how the website is built, there are some websites that allow to use the back button while logged in. Generally you should not use the back button on a website where you log in to your account. You can try that this happens in other browsers as well so just don't use the back button on websites where you log in. You can open a new tab for websites where you log in so that your browsing won't get mixed up with your personal stuff.

  • Removing XML elements

    Hi all!
    I have a problem about an xml. I have to eliminate redundancy
    So from this xml:
    <xml1>
    <Property>
    <Parameters1>
    <Param>
    <name>A</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>B</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>C</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    </Parameters1>
    <Parameters2>
    <Param>
    <name>A</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>C</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>D</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    </Parameters2>
    </Property>
    </xml1>
    I want to obtain this xml:
    <xml2>
    <Property>
    <Parameters1>
    <Param>
    <name>A</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>B</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>C</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    </Parameters1>
    <Parameters2>
    <!--Parameters A and C are missing-->
    <Param>
    <name>D</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    </Parameters2>
    </Property>
    </xml2>
    There are just parameters without repeting.
    My code until now is:
    private String numeParam;
    private Vector elParam = new Vector();
    for (int i=0;i<rootlist2.getLength();i++)
    Element element2 = (Element)rootlist2.item(i); // rootlist is my doc xml
    if (element2.getLocalName()==Property)
    NodeList childrenName2 = element2.getChildNodes();
    for (j=0;j<childrenName2.getLength();j++)
    Element elemm = (Element)childrenName2.item(j);
    if ((elemm.getLocalName() == "Parameters1")||(elemm.getLocalName() == "Parameters2"))
    NodeList param = elemm.getChildNodes();
    for(int y=0;y<param.getLength();y++)
    bn=true;
    bas=true;
    Element childInProperty2 = (Element)param.item(m2); // acesta e de sters
    if (childInProperty2.getLocalName() == Param)
    NodeList tlist =childInProperty2.getChildNodes();
    for (int y = 0;y<tlist.length();y++)
    Element childInPUParam2 = (Element)tlist.item(y);
    if (childInPUParam2.getLocalName()== "name")
    numeParam = childInPUParam2.getTextContent();
    bas=false;
    if (bas==false)
    if (!elParam.contains(numeParam))
    elParam.addElement(numeParam);
    if (elParam.contains(numeParam))
    bn=false;
    break;
    } end if
    } // end for
    if (bn==false)
    ba = false;
    if (bn==false)
    System.out.println("C");
    ba = false;
    elParam.clear();
    this is working I a kind of way, but this remove some elements that is not god. I wonder... Is like elParam contains some strings but, after me is imposible.
    Thanks all

    Why don't you use XPath? Anyway.
    -> Get a List of the documents Node
    -> Get a List of all children
    You have to check each Node:
    -> if the node is not null
    -> if the node's name is not null
    -> if the node's content is not null
    -> if the node's name is equals (<name>)
    If the Node-Element is found, store it in a Collection (the reference of the node object).
    Later you could iterate the collection and remove all Nodes from the Document.
    Afterwards you can transfer the document to a xml file.
    btw: if you use XPath you have to be sure to use at least Java 1.5
    Regards,
    Florian

Maybe you are looking for

  • "Do it for me"

    Hi, We don't officially use captivate at my workplace but we're investigating it's ability to meet our current standards. I'm the guinea pig. Currently, with the software we use, we are able to have an interactive simulation where the user, for examp

  • Error for SOAP to BAPI scenario

    Hi  All: When I am trying to send the message from SOAP client to XI I am getting and Error and also the message is not reaching to MONI. Is there anything that is required in in SOAP adapter or Modules setting?? Error : <b><?xml version='1.0'?> <!--

  • SSIS 2008 R2 Excel Destination Error, "An OLE DB error has occurred. Error code: 0x80040E21.", cannot export to the new Excel (.xlsx) format

    Hello. I've been attempting to do a very simple task that just isn't working.  For a Data Flow Task action in SSIS, I am trying to export data from a single SQL Server (2008 R2) database table to an Excel spreadsheet (.xlsx).  No matter what I do, it

  • Why are the older ipods more expensive?

    Hello, I am trying to purchase another i-pod. The one I have is full. I do not need all the bells and whistles. I noticed the older i-pods that do not have so many options, but still have a fair amount of memory are discontinued or are very expensive

  • Induced Error Linking to CSS  files

    When I link (in the CSS panel ) a CSS file locally to an html page I get the following: <link href="/css/type.css" rel="stylesheet" type="text/css" /> The CSS folder is in the same folder as the page so the path is almost correct but its the leading