Unable to remove object from arraylist

Hello,
I am trying to remove a few objects from an arraylist and it isnt happeneing in one loop :
                     for(int i=0;i<someList.size();i++){
                         empVo = (EmpVO)colList.get(i);
                         if(empVo.getempName().trim().equalsIgnoreCase("A") ||empVo.getempName().trim().equalsIgnoreCase("B") ||empVo.getempName().trim().equalsIgnoreCase("C") )
                            colList.remove(i);
                     }So, it doesnt remove the object all the time whenever the names of A,B or C appear, so I have to run this loop thrice so it deletes all the data pertaining to these three emp names. Then I thought may be the size of the arraylist is changing and used a temp var for the someList.size, but that doesnt work either. Could you please tell me what is going wrong ?
Edited by: Sarvananda on Sep 3, 2010 12:10 PM
Also, the exact test has names A to F. So say A, D and E will be deleted in the first loop, then I have to specifically sysout and see which ones were deleted and then write another loop for B,C and F. Ofcourse at the end A - F are removed. But why two loops for it

Encephalopathic wrote:
What if you do this using an iterator to remove items, or if you start from the top of the list and iterate down to the first item?thanks for your reply. I was just looking at the API, and stumbled on this :
The iterators returned by this class's iterator and listIterator methods are fail-fast: if the list is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove or add methods, the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.Any pointers on where I could look or how I could I move from here ?
Another question I had was, there is no efficient way to 'move' objects in an arraylist (based on their indexes), isn't it ?
I always have to remove and add at a certain index.

Similar Messages

  • Remove Object from ArrayList

    Hi,
    i want to remove an object from my ArrayList. The Array-List contains objects from a class like this:
    public class Data {
         String id;
         String name;
         String data;
         //getters
         //setters
    myArrayList.remove(myData);
    This doesn't work! Why not? What is wrong?
    Daniel

    The ArrayList determines which element to delete by the equals() method. The default implementation of equals() tests for instance identity. So two instances of your class with absolutely identical data fields will not match! You probably just need to override the default equals() with a proper implementation and everything will work.

  • Unable to remove image from photoshop

    unable to remove image from photoshop

    in the top line under adobe photoshop cs6
    the data of the 2 images appears if  i check the x it goes away  only to return the next time I close photo and reopen cs6
    same thing happens  if I close individually  or close all    seems that any I way close it  or empty  the data bar
    then close photo shop and reopen it  the 2 images are back   open photo shop from application in the application folder same thing
    cut clear grayed out under edit

  • Error removing object from cache with write behind

    We have a cache with a DB for a backing store. The cache has a write-behind delay of about 10 seconds.
    We see an error when we:
    - Write new object to the cache
    - Remove object from cache before it gets written to cachestore (because we're still within the 10 secs and the object has not made it to the db yet).
    At first i was thinking "coherence should know if the object is in the db or not, and do the right thing", but i guess that's not the case?

    Hi Ron,
    The configuration for <local-scheme> allows you to add a cache store but you cannot use write-behind, only write-through.
    Presumably you do not want the data to be shared by the different WLS nodes, i.e. if one node puts data in the cache and that is eventually written to a RAC node, that data cannot be seen in the cache by other WLS nodes. Or do you want all the WLS nodes to share the data but just write it to different RAC nodes?
    If you use a local-scheme then the data will only be local to that WLS node and not shared.
    I can think of a possible way to do what you want but it depends on the answer to the above question.
    JK

  • Unable to remove iLivid from Firefox because Firefox will not launch.

    I am attempting to remove iLivid from my computer. It has hijacked my browser. I removed it from IE and Chrome; however, I am unable to remove it from Firefox because it will not launch. How can I remove this "thing" from Firefox if it will not launch???? I used the shortcut on the taskbar, the icon on my desk top and also the navigation menu. None will launch Firefox.

    See these threads and pages about searchqu/searchnu:
    *[[/questions/816181]]
    *[[/questions/790833]]
    *[[/questions/921690]]
    *http://bit.ly/searchqutoolbar
    *http://www.ilivid.com/faq.htm#8
    *http://www.beyourownit.com/forum/security-malware-issues/4758-searchnu-searchqu.html

  • UnsupportedOperationException Error while removing object from List

    Hi,
    I need to remove a set of objects from List if it contains similar objects as the other one.
    Follwing is the code snippet of the above scenario...
    List selectedPaxList = new ArrayList();
    TreeSet seatAssignedPaxlist= new TreeSet();
    selectedPaxList.add("1");
    selectedPaxList.add("2");
    selectedPaxList.add("3");
    seatAssignedPaxlist.add("1");
    seatAssignedPaxlist.add("2");
    if(selectedPaxList.containsAll(seatAssignedPaxlist))
    selectedPaxList.removeAll(seatAssignedPaxlist);
    If i do this in java program it executes fine without any error.But if I do the same in JSP I am getting the following error......
    java.lang.UnsupportedOperationException
    at java.util.AbstractList.remove(AbstractList.java:167)
    at java.util.AbstractList$Itr.remove(AbstractList.java:432)
    at java.util.AbstractCollection.removeAll(AbstractCollection.java:351)
    Plz... help me to resolve the issue

    java.lang.UnsupportedOperationException
    at
    java.util.AbstractList.remove(AbstractList.java:167)
    at
    java.util.AbstractList$Itr.remove(AbstractList.java:43
    2)
    at
    java.util.AbstractCollection.removeAll(AbstractCollect
    ion.java:351)
    That stack trace looks wrong to me.
    ArrayList overrides the remove method, so it
    shouldn't be using the method in AbstractList. That's what I thought, too. There is either something missing or it's not an ArrayList. In fact the javadoc of AbstractList.remove sais:
    "This implementation always throws an UnsupportedOperationException."
    So it really looks like another subclass is used.
    Also
    the object it is trying to remove is a list (from
    your exmaple it should be a String)
    I could be wrong.These are just the code references not the parameters, I think.
    -Puce

  • How to remove objects from pics using LR...

    I am not a professional photographer and I do not have a whole lot of photo editing knowledge. I started out several years ago using Photoshop elements 5 and eventually learned how to do several things like moving objects around or removing them from a photo, or moving someone's face into a different picture if their eyes were closed and lots of nice editing features. I loved it and still love it. My laptop was getting really old and slow so I just recently purchased a new computer which has windows 8 on it. I loaded my photoshop elements and cannot get it to open or work properly and am wondering if it's because of the windows 8 operating system. So I then decided to purchase a new photo editing software. I decided (quickly.. too quickly) to purchase adobe lightroom just because it had very good reviews online. Now I have several pictures that need to be edited for Christmas and I cannot find any "lasso tool" or any thing similar right now.. I was so used to using the layers and features from the PE and now my heart is broken because I feel so lost and maybe broke at the same time!! This program is soooo different than what I was used to using but I don't even know if I can do the same things with it. EXAMPLE: there is an air conditioner unit in one of the photos I've taken and I was planning on removing it from the picture. Also I was aiming on moving a face over from another picture because of some closed eyes.. Someone please tell me, is this program capable of doing these things or can I only play with the lighting in this? Will I have to spend more of my $$ to get another Photoshop elements to get the features I use?

    These tasks are tasks for Photoshop or Photoshop Elements, not for Lightroom, which is more an image data base.

  • How can we know the affected reports when i remove object from universe

    Hi All,
    If i remove any objects from the universe.
    How can i know the list of affected reports.

    Thanks for your update.
    It shows what are all the reports has been created  by using that particular universe.
    But my question was, if i remove any object from the universe, Then what are all the reports affected(We may not use that deleted object in all the reports)

  • Removing objects from photo

    I am trialling photosup elements before deciding to buy it or not.  Not sure if there is a difference in the trial version compared to the purchased version. I am trying to remove an unwanted object from a picture by highlighting the unwanted object,  then I go to edit and then fill. However there is no option for "content aware" under the fill option as shown in the tutorial.  As a result, if I choose any of the options under the fill tab,  it will only remove the object and leave a "blank spot" on the picture.  Have I missed some steps here please?  Thank you.

    Thank you all for your advice. It certainly was amazing what you were able to do with your suggestions.  As mentioned,  I am trialling photoshop elements (before deciding it is a product that I can use with ease) and was facinated by the ease of use on the tutorials, particularly the content aware move function. If I am not mistaken, it seems to suggest it is a matter of highlighting the object to be deleted / moved, then choose the content aware move function, and photoshop will do all the 'patching' and merging of surroundings.  So basically a click of a button.  Unfortunately I couldn't find that function on the trial version of the product.  So was wondering if the function is actually available on the trial version so I can see if I can use it before resorting to other alternatives.  Thank you.

  • Unable to remove delegates from calendar:

    While removing delegates from calendar error is generated "The Delegates settings were not saved correctly.  Cannot activate send-on-behalf-of list.You do not have sufficient permission to perform this operation on this object."
    I Referred  and re-added AD permissions & also made desired registry settings as per below solutions in links but no luck! Please suggest.
    http://support.microsoft.com/kb/2593557
     http://community.spiceworks.com/how_to/show/41829-getting-error-after-adding-new-delegates-the-delegates-settings-were-not-saved-correctly-cannot-activate-send-on-behalf-of-list-you-do-not-have-sufficient-privileges-to-perform-this-operation-on-this-object
    Aditya Mediratta

    I found a fix for this. The mentioned user that was added as delegate
    missed send on behalf of permission on mailbox, Re-adding permissions and then removing this from delegate
    got this fixed. Thanks All!
    Aditya Mediratta

  • Remove object from TR

    Hi Expert,
    I want to remove DTP from TR , I accidently collected before I info cube and MP.Trying to stay in sequence...is there any problem if you add this object later in another TR ???
    Please advice on this.Thanks in advance
    Edited by: ramshri on Aug 18, 2011 11:50 PM

    Hi
    Just go to SE03,
    Under the folder, REQUESTS/TASK---
    Select UNLOCK Objects,
    Then ENTER your Transport Request
    Click Execute button
    Click Yes
    Then go to SE09,
    Expand the PArticular request with sign '+" on left hand side
    Then , look for the technical name as DTP_
    Select that ..by placing cursor over there, and then choose the DELETE button below the MENU option on the top of the screen where there is small ICON.
    Then again in SE09, Select the MENU Request/Task, look for the Object List which is at the last, and then expand by clicking the right arrow, and select LOCK OBJECTS from the CONTEXT MENU
    or
    Select the particular REQUEST by placing the cursor on it, and PRESS CTRL+F3
    Then you can add it another request if you want else create another etc..do as you like.
    Hope this helps you

  • Removing object from kodo datacache doesnt always work.

    Hi,
    We're using a very old version of kodo - 3.4.1 but it seems to work well.
    We seem to have come across an intermittent issue where if we remove an object from the datacache using the DataCache.commit call, then the object doesnt actually seem to get removed. So the application continues operation with the out of date cached object. We get no exception or error though.
    Has anyone see anything like this before? I can't seem to find any available known issues list or bug database for kodo, I guess this isnt available?
    Thanks,
    Dan

    The size will refer to individual DataCache size.
    KodoPersistenceManager.getDataStoreCache() or getDataStoreCache("myCache") will return the default or named datacaches respectively.
    You can evict the L2 cache content on the returned DataCache instance from the previous methods.

  • Unable to create object from stored procedure universe

    Dear All Experts,
    I am facing a problem on unable to create object dimensions on a Stored procedure universe. Fyi, I have successfully insert a stored procedure ('SP_Sales') with input parameter (@date) into universe (Universe_1). But I unable create any object based on the the stored procedured ('SP_Sales') due to it show nothing from the Edit Select Statement of 'Object1', empty for Tables nd columns windows.
    Thefore, i unable to drag data in WEBI when i select univese as "Universe_1", it will not sure any object. Please advise.
    I am using XI4.0, MSSQL2008.

    Hi ,
    You wont be able to edit the object definitions.
    u2022 Designer generates one table per selected stored procedure (or many
    tables if multiple result sets) and one object per column returned by a
    stored procedure.
    u2022 The result set structure is determined when you describe the function.
    Please refer chapter 7(Page 451) of below document for more details.
    [Universe Designer Guide|http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_designer_en.pdf]
    Hope this helps.
    Bilahari M

  • Remove object from Linkedlist?

    Hello,
    I built this function to return the object with the lowest cost variable, and remove this object from the linkedlist.
    The method does not always seem to return the object with the lowest cost. I wondered if the problem was because I removed the object being returning?
    Could anyone see the problem?
    Thanks
    Node lowestState(LinkedList list){
    Node object = (Node) list.get(0);
    int index = 0, cost = object.getCost();
    for(int i = 1; i < list.size(); i++){
    object = (Node) list.get(i);
    int testCost = object.getCost();
    if(testCost < cost){
    cost = testCost;
    index = i;
    list.remove(index);
    return object;
    }

    get() must traverse the links until it finds the given one.
    So get() behaves O(n), like the whole traversal.
    import java.util.*;
    public class llt {
    static LinkedList li = new LinkedList();
    static int LIMIT=64*1024;
    public static void main(String args[]) {
         for(int i=0;i<LIMIT;i++) li.add(new Integer(i%7 * (i%3) + (i%5)));
         for(int k=0;k<4;k++) doit();
    static void doit() {
    int i;
    int sum=0;
    long t0=System.currentTimeMillis();
         for(i=0;i<li.size();i++) {
              sum += ((Integer) li.get(i)).intValue();
    long t1=System.currentTimeMillis();
         for(ListIterator lii =li.listIterator(0);lii.hasNext();) {
              sum -= ((Integer) lii.next()).intValue();
    long t2=System.currentTimeMillis();
         System.out.println((t2-t1) + " " + (t1-t0) + " " + sum);
    0 27594 0
    0 27719 0
    0 28359 0
    0 27391 0

  • RMAN - Unable to remove archivelogs from catalog

    Hi
    I have missing archivelogs and want to remove them from caltalog. The controlfile is beeing used as catalog. I have done the following:
    CROSSCHECK ARCHIVELOG ALL;
    -For the missing archivelogs RMAN output is "validation failed for archived log".
    DELETE FORCE EXPIRED ARCHIVELOG ALL;
    -output says:
    deleted archive log
    archive log filename=/an/log/autonar/archive/1_317009_555884131.dbf recid=5088 stamp=685099967
    Deleted 1 EXPIRED objects
    However the command does not remove the logs from catalog.
    LIST ARCHIVE LOG ALL; still shows the above archive logs.
    Next, i tried:
    CHANGE ARCHIVELOG like '%317009%' UNCATALOG;
    And the result is the same:
    uncataloged archive log
    archive log filename=/an/log/autonar/archive/1_317009_555884131.dbf recid=5088 stamp=685099967
    Uncataloged 1 objects
    But i can still see the files in the catalog.
    Why is this happening? Anyone had problems like this?

    The problem is in the controlfile. I'm not using the database catalog, just the controlfile.
    However, I did try registrating the database on rman catalog. But the results are the same when i execute above mentioned commands.
    I also tried manually removing rows from the catalog table (RMAN.AL table). This does remove the enteries from the catalog, but not from the control file. So after the next resync, the catalog gets the information back from the controlfile and i'm back to beginning. :(

Maybe you are looking for

  • Error while booting or loading application server by runing psadmin.exe

    HOw to upgrade the database to 8.49 from 8.48 also to update the patch to 8.49 need to be a customer id or licensed something like that... i am using a trial version .....please suggest ==============ERROR!================ Boot attempt encountered er

  • Display malfunction at Satellite L300

    Hi All out there in computer land. I've had a L300 for some time now and its been a great machine, however the other day I swiched it on and there are now lines across the display at various points. Some of the lines don't start at an edge and don't

  • [JS] Updating a dropdownlist

    In ScriptUI, let's say I have a window that's current;y displayed with a dropdownlist in it. is there anyway to add items to the menu while the window is open? I've been able to use removeAll() to remove the items from the menu, but I want to add thi

  • Help regarding algorithm..

    One of my tables is having following data : Category     Scheme     SchemeType     Amt A          ABC     Z1          10 A          ABC     Z2          20 A          DEF     X1          18 A          DEF     X2          15 B          XY     A1       

  • Having trouble with WWF, internet and mail says not conected to WiFi but I am and says I don

    Says I have no WiFi connect but I do.  When I try to play WWF will let me play word but doesn't update.  Interet says Safari not conected to internet but I am.  Will not update my e-mail.  Any suggestiosn. I tried turning off IPAD but doesn't do anyt