Ho to remove duplicate element in the List ?

It seem to be very basic, but it not working, even I try different way.
This my List [10, 10, 11, 11, 12, 12, 13, 13, 14, 14],
now to remove duplicate elements to have at the end [10, 11, 12, 13, 14]
my code seem to be perfect but...
for(int i = 0; i < listA.size(); i++){
     if(i%2 == 0){
          System.out.println("ce i est un nombre pair "+i);
          listA.remove(i);
System.out.println(listA);

senore100 wrote:
The problem is that every single time an element is removed, the whole ArrayList is re-shuffled, with all the elements to the right moved to the left on spot. That's why.Yes, that's right. However if you had used an Iterator over the list, you could easily have removed every other element. It's only when you use an array index that you run into this (very common) problem.

Similar Messages

  • HT2905 How to remove duplicate songs from the iPhone when the duplicates are not listed in the iTunes library on the computer.

    How can I remove duplicate songs from the iPhone4. The duplicates are not listed in the computer iTunes library.

    The simplest thing may be to back-up and then restore the iPhone. If you don't fancy that then remove all media that is currently synced to it, then double check and manually remove any media that remains on the device, before reselecting your sync options.
    If you've been manually managing the device and your library doesn't contain copies of all your media then see Recover your iTunes library from your iPod or iOS device.
    tt2

  • How does one remove duplicate versions of the same songs on an iPhone5?

    How does one remove duplicate versions of the same songs on an iPhone5?

    Yes, I use Live Bookmarks.
    This is the RSS http://www.ctech.com/forum/rss.php
    Each of those entries at the RSS site show up in my Firefox RSS folder twice. The content of each entry when I go to it is exactly the same. It's not that one is the reply to the original post or anything like that. For instance, see the attached image of the list of items that show up. The highlighted yellow on top is an example. Both of those links display exactly the same original post and replies. Why is that? Is is possible that somehow I'm subscribed twice? Does that make sense? How can I delete the duplicates, or for that matter, clear all those items that show on the list? I just want to see the new ones. Thanks.

  • How to remove available downloads from the list

    how to remove available downloads from the list without it resuming when i open itunes or check for available downloads?

    There is not a way to remove them from the list.  Just let them download, and then delete them from your library when they are done.

  • Is there a way to remove an app from the list of previously installed apps?

    Is there a way to remove an app from the list of previously installed app?
    The list that comes up when you click on the Purchased icon when updating apps.
    The list is becoming quite large after I installed and tried out a few apps.

    nvm. I found it.

  • I would like to know, on the ringtone page, where you can select songs out of your music library, is there a way to remove a song from the list after its selected? I would thin there would be a way to "delete" the songs from the list. (Clock app)

    I would like to know, on the ringtone page, where you can select songs out of your music library, is there a way to remove a song from the list after its selected? I would thin there would be a way to "delete" the songs from the list. (Clock app)
    Let me explain:
    In the clock app for ios 6.0.2 I am a little confused. It allows you to go into your music library, and create a ringtone using any songs you choose. However, I cannot find a way to remove a song from this list, just like I cannot delete one of the preset ringtones (which I'm not trying to do, but just as an example)
    Thanks for your time! If you need more information just ask.
    (I believe both my iPod and iTunes are up to date)

    I believe you just are able to delete them from iTunes.
    Hope it will be helpful

  • Add an element to the list in run time

    There is an item in my form which is a list of values.It is getting populated based on a record group query.
    I want to let the user enter values at run time and add the values to the exiting list in the form and same
    should be added to the record group so that next time i open the form the added value can be seen.
    Is this possible?
    Regards,

    I have written this code on when_button_pressed trigger to populate the record group RGSTD and LOV(Name LOVSTD).
    I have added the element in the list using add_list_element built in. But it is not giving me proper results.
    Record group has two columns STDID and STDNAME.
    DECLARE
    ln_num NUMBER := 0;
    BEGIN
    ln_num := show_alert('ALERT15');
    IF ln_num = 88 THEN
    add_group_row('RGSTD', 1);
    set_group_char_cell('STDID', 1, 'ST00004');
    set_group_char_cell('STDNAME', 1, 'Add To List');   
    add_list_element('LOVSTD', 1, 'Add To List', 'Add To List');  
    ELSE
    NULL;
    END IF;
    END;Edited by: LostWorld on Feb 9, 2009 5:49 AM

  • If I use an app to remove duplicate pix does the app  read content  or only  the file name such as IMG

    If I use an app to remove duplicate pix does the app  read content  or only  the file name such as IMG. I have some 2500 pix  and the thought of trawling thru  them  toremove duplicates is mind numbing.
    If the apps  read the content then I am ok about that  but if they  only read the  file name ... they maybe  deleting stuff that  isnt really a duplicate

    You have to contact with the developer of the application. We do not know which app you are referring to and we do not know how that application works, but all apps of that type are supposed to delete duplicate files with the same format (like IMG, JPG...)

  • HT2905 Does anyone know how to find and remove duplicate items in the new itunes 11?

    I am having a hard time trying to figure out how to find and remove duplicate items under the New iTunes 11? Its not as user friendly as in previous versions. Does anyone know how to figure this out?

    As Jim said View > Show Duplicates
    or
    Option + View > Show Exact Duplicates

  • Removing specific element from a list

    Hello, I'm very new to java, and to programming in general.
    I'm trying to write a secret santa app for my family for christmas. Essentially the idea is that 7 names are put into a list, and each time a name is "pulled" (i.e. randomly assigned to a name /= itself) it will be removed from the list of available names to assign.
    String[] nList = { name2, name3, name4, name5, name6, name7 }; // store names for random use
    Random r = new Random();
    name1assign = nList[r.nextInt(nList.length)];
    String[] nList2 = { name1, name3, name4, name5, name6, name7 };
    name2assign = nList2[r.nextInt(nList2.length)];
    My goal for this is to take the string that is equal to name1assign, and remove an element with that string from nList2.
    Can anyone give me some advice in this matter?
    Thanks.

    Sometimes a null value is used to indicate an 'empty' array element, but it would be better to try collections instead.
    You could use an ArrayList instead of an array. This has methods to remove items by index or value.
    An ArrayList also works with Collections.shuffle, which allows you to simply iterate over the list and not deal with random or removing elements at all.

  • How to add more elements in the list box bean

    Hi,
    I have created a list box bean on a seeded page. I have an array of 573 elements.
    When I tried to add all those values in my list box, only 251 of those values got inserted in it.
    Please suggest me how can I insert all the 573 values in that list box.
    Regards,
    Gaurav.

    Thanks Gyan.
    Below is the code for creating list box :
    OAApplicationModule am = pageContext.getRootApplicationModule();
    OAViewObject listVO=(OAViewObject)am.findViewObject("LocationsLOVVO");
    OAWebBeanFactory list1 = pageContext.getWebBeanFactory();
    OADefaultListBean list = (OADefaultListBean)list1.createWebBean(pageContext, OAWebBeanConstants.DEFAULT_LIST_BEAN, null, "LocationsList");
    list.setListViewObjectDefinitionName("oracle.apps.irc.lov.server.LocationsLOVVO");
    list.setListValueAttribute("LocationCode");
    list.setListDisplayAttribute("LocationCode");
    list.setSize(6);
    list.setMultiple(true);
    list.setName("Location");
    OAMessageLayoutBean listboxbean = (OAMessageLayoutBean)webBean.findChildRecursive("AplmessageLayout");
    listboxbean.addIndexedChild(list);
    But it is not inserting all the location values in the list.
    Regards,
    Gaurav.

  • How do I remove a device from the list?

    I had an old Bluetooth device that I no longer own. Its name still appears in my Bluetooth list. How do I remove it? The Troubleshooting manual says:
    8. How do I remove a device from the device list?
    Using the Bluetooth preferences, select the device you want to remove to highlight it, then click the minus sign. It is recommended that you remove a device from this list while the device is connected.
    This does not work. There is no minus sign anywhere. I tried clicking the minus sign on my keyboard, but that is not it. Any suggestions?

    Its name still appears in my Bluetooth list.
    What Bluetooth list? You've completely neglected to tell us what mobile device or computer running what operating system you are referring to.
    I'll make a guess that you're using a Mac. If I'm right, the minus sign is here:

  • I was connecting on my ipad to Find my ipad with the account of my sister (somebody stole her ipad..) and her ipad was obviously offline. Then i removed her device from the list (i know itd reappear on the list if it comes back online),but can i readd it?

    Question above

    i didnt mean to remove it, i did it unintentionally.
    If the offline device is removed do i receive emails if it comes back online?
    p.s.: still no answers to how i have to put the offline device back on the list of my devices?!?

  • Remove duplicate records in the Footer

    Hello all:
    I only want to print the final result(distinct records) in the footer section, therefore, the header and details sections are suppressed. However, I'm showing duplicate records in the footer section. How do I suppress the duplicate records?
    Please help.....Thank you so much in advance
    Here are my formulas : 
    Header
    WhilePrintingRecords;
    StringVar ConCat:=""
    Details
    WhilePrintingRecords;
    StringVar Concat;
    ConCat := Concat + Trim(ToText({MEDICATE.STARTDATE},"MM/dd/yyyy") + chr(7) + {MEDICATE.DESCRIPTION}) + chr(13)
    Footer
    WhilePrintingRecords;
    StringVar ConCat;
    Here's my desired output:
    HUMALOG PEN 100 UNIT/ML SOLN
    LANTUS 100 U/ML SOLN
    METFORMIN HCL 1000 MG TABS
    Below is an example my current output:
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS

    Sorry, I forgot to mention I'm already grouping by Patient Name, and that's where I have created a formula called:
    MEDSHEAD - which I've modified and added the concat line.
    WhilePrintingRecords;
    //StringVar ConCat:="";
    StringVar ConCat;
    ConCat := Concat + Trim(ToText({MEDICATE.STARTDATE},"MM/dd/yyyy") + chr(7) + {MEDICATE.DESCRIPTION}) + chr(13);
    In the detail section : I'm displaying the the patient's name, DOB and Gender and the hemoglabin lab result and date of the lab result.
    In the patient's footer section is where I have the formula called: medsfooter (WhilePrintingRecords; StringVar Concat; Concat;)
    The changes that I made, eliminate some of the duplicate records, however, it's no longer initializing the values - what I meant is I am getting the previous patient's medication information:
    See output below:
    Patient One              4/25/1958     F
    6/26/09 12.2
    9/2/2008-Glipizide XL 5 MG TB24
    4/2/2009-Novolog 100 unit/ml soln
    Patient Two          12/11/45       F
    9/2/2008-Glipizide XL 5 MG TB24
    4/2/2009-Novolog 100 unit/ml soln
    11/24/2009-Humalog Pen 100 Unit/ML soln

  • HT2500 how do you remove invalid addresses from the list mail remembers(not in contacts)

    mail keeps a list of previously sent addresses for a corespondent seperate from contatcs. I have corespondents who have changed addresses and if I am not carefull the old address gets picked and bounced. How do I find and edit the list?

    From within the Menu bar in Mail, select "Window" - Previous Receipients. From here select and delete any unwanted or incorrect addresses.

Maybe you are looking for