Extract from ArrayList without duplicate

Here is my acctual "headache":
I simply am trying to extract objects from an ArrayList into another. The thing is that the other shouldnt contain any duplicate.
i am trying this:
String[] rowValues;
               //Label label = null;
               int rowCount = 0;
               Individual newIndividual= null;
               List<Individual> individuals = new ArrayList<Individual>();
               List<Individual> temp = new ArrayList<Individual>();
               // TODO Performance test
               // Populating xls file
               while ((rowValues = p.getLine()) != null){                    
                    // find the Individual+ column
                    newIndividual = new Individual(
                               rowValues[PerformanceReportStyleEnum.INDIVIDUAL_PLUS.COLUMN_NUMBER()],
                               rowValues[PerformanceReportStyleEnum.GROUP_PLUS.COLUMN_NUMBER()]);
                    if (rowCount == 1){
                         individuals.add(newIndividual);
                         temp = individuals;
                         rowCount++;
                         continue;
                    for (Individual item : temp) {
                         if (item.getName().equals(rowValues[PerformanceReportStyleEnum.INDIVIDUAL_PLUS.COLUMN_NUMBER()])) {
                              // do nothing
                         else {
                              individuals.add(newIndividual);
                    temp = individuals;
                    rowCount++;     
               for (Individual item : individuals) {
                    System.out.println("Name: " + item.toString());
               }any suggestion? i am quite a newbie to figure it oout myself ;)

but of course... the set could assure uniqueness :-)
so i now tried this:
Set<Individual> individuals = new HashSet<Individual>();
               // TODO Performance test
               // Populating xls file
               while ((rowValues = p.getLine()) != null){
                    // find the Individual+ column
                    newIndividual = new Individual(
                               rowValues[PerformanceReportStyleEnum.INDIVIDUAL_PLUS.COLUMN_NUMBER()],
                               rowValues[PerformanceReportStyleEnum.GROUP_PLUS.COLUMN_NUMBER()]);
                    boolean add = false;
                    if (!individuals.contains(newIndividual)) {
                         add = true;
                    else {
                         add = false;
                    if (add)individuals.add(newIndividual);
                    rowCount++;     
               Iterator<Individual> iter = individuals.iterator();
               int counter = 0;
               while (iter.hasNext()) {
                    System.out.println(((Individual)iter.next()).getName());
                    counter++;
               }this doesnt help though since the if (!individuals.contains(newIndividual)) {
always seems to be true (or rather !true) and therefor duplicates occurs. what i am missing?
thx for your quick answer.

Similar Messages

  • EXTRACT VALUES WITHOUT DUPLICATES

    How can I extract data without duplicates??
    I can't use DISTINCT....
    Thank you

    Hi,
    DISTINCT and UNIQUE keywords performs same in SQL and no difference in usage. Just write,
    SELECT UNIQUE <column_name>
    FROM <table_name>
    WHERE ...
    Regards,
    Dilek

  • HT204406 How to delete duplicate songs from Libary without deleting them from play list or other devices

    How to delete duplicate songs from libary without deleting them from playlist or other devices

    I'm with you verm71; it's not entirely clear how Apple is expecting you to manage this.  I'm going on vacation soon and want to clean up my phone so that it's nice and empty for the new pictures.  There doesn't seem to be a way to do this without losing your pictures in the new Photos as well.  If imported, it's impossible to see which is the Cloud version and which is the Local version.  It's very annoying.
    I've also noticed in iPhoto you used to have the ability to locate the original of the picture inside the photo database.  That option is not provided in Photos, making finding the original extremely difficult.
    It seems to be a great, well-oiled system.  But I would love to know how Apple envisions the typical workflow for archiving...

  • Extract text from PDF without opening PDF in window C#

    Hello,
    I'm creating a application for searching text in PDF's. I found some code wich uses the SDK from Acrobat (Installed on my system). But all the snippets I find seem to open a PDF window and then extract the text. Is it possible to extract the text without openening this window. I think this would increase the search time since I need te search a lot of files. And I just need a list with the file name and page number where the search string is found.
    AcroAVDoc avDoc = (AcroAVDoc)gAppClass.GetInterface("Acrobat.AcroAVDoc");
    Then I use the javascript obects to acces the "getPageNumWords" and "getPageNthWord" in a loop and putting the word in a string.
    Thanks in advance fore the help.
    I didn't want to put the entire code here because it's easely found all over the web
    Thanks in advance for your help.
    avDoc.Open(System.IO.Path.GetFullPath(filespec), filespec); 

    Hello,
    I own a copy of Acrobat pro 9. and its is for my own use. I am not a proffesional developper and this application wil not be distributed.

  • Extraction from web service without XI

    Hello all!
    I want to realize data extraction scheme without usage XI
    DB2 Stored proc -> Web Service -> BW
    Is realy?

    Hello can you refine your question with more specification?
    Yes, it can possible data extraction from web service, but what you are exactly looking for?

  • How do i restore photo albums from time machine backups without duplicates?

    how do i restore photo albums without duplicates from time machine backups? thx

    Worth updating?  Totally a personal decision. For some it would be. For others it would not?
    Upgrading, if there are no problems, does not affect your data. And since bad things do happen you always have a good backup. Especially when doing any upgrade.
    Your password question has nothing to do with iPhoto. Try it in the OS forum
    LN

  • Extraction from 0HR_PY_1 error??????? pls respond immediately

    i would need to extract data for payroll data from data source 0HR_PY_1 to BW based on the period of time say for example 01.2007 to 12.2007, the infopackage in Production is in full load i would need to initalise it to Delta. for this, i can first run full load for the period 01.2007 to 12.2007 then go for init of delta without data transfer and delta will be intialized and then select the radio button delta and go for delta extractions. this is what i need to do now.
    for this i have extracted data from 0HR_PY_1 from R/3 to BW in full load, but in after extracting more than one crore records were extracted with a failure(red color status), it says that data is not extracted from correct client which seems to be wrong because only one client is maintained for R/3 Production and in RSA3 i could see no record for that data source, i wonder how those many records were extracted from ????.
    and i also see the error saying "No assignment of payroll data to BW month". it is giving this error while extracting for the year 2007 but for the year 2006,2005 full load is done and it has not thrown such error.
    do you think Assignment of payroll data to BW is compulsory, because i could see no assignment in R/3, if that is not done then how could 2006, 2005 years of data been extracted and when they are extracted i am not sure when and how they were extracted.

    Hi,
    Take a look on the notes:  585682,590957
    With rgds,
    Anil Kumar Sharma .P

  • Extract from BSAS and BSIS in FI to BW

    Hi,
    Can someone please recommend a method of extraction from BSAS and BSIS to BW.Is there a standard datasource available for this or do we have to do it through Generic extraction?
    thanks
    Srishti

    Hi Priya,
    To avoid the complexity of converting XML's to Idocs without XI or ABAP programming you can easily go for the LSMW uploading.
    I know your company does not want to use the LSMW process.However if you are trying with the XML ports for the XML to Idoc convertion it will further involve extensive coding and complexities.
    On the other hand you can extract MDM data in simple Excel format and then use LSMW with simple mappings and conversion to upload this master data in ECC without much difficulty.
    As to work with the MDM and ECC system data transfer avoiding both XI and Lsmw as the data transfer tools will make your scenario more complex and error prone with ofcourse the extra time factor involved.
    Hope it helps
    Thanks & Regards
    Simona Pinto

  • Process KPI extraction from BPM to BW possible? Is there content available?

    Hallo
    I have a question concerning BPM. Does anybody know if there is standard content and/or an extractor to retrieve BPM Process Data from the CE 7.1? I am looking for something similar as the SAP Workflow extractor and/or data model.
    Does someone have a suggestion?
    Regards,
    mingolo

    Hi mingolo,
    Didn't you already ask the same question in the following thread?
    Process KPI extraction from BPM to BW possible? Is there content available?
    I assume that this might be a duplicate and therefore close it.
    Best regards,
    Martin

  • Parallel Data Extraction from R3 to BI

    Dear Experts,
       I am trying to execute Parallel data extraction from R3 Development to BI development.It was previously done smoothly .Without any changes its stop in parallel .Your suggestions are welcome.
    Regards
    SurendraJain

    Hi Surendra,
    thanks for your reply, I am not a basis expert but a BI person. You did not detail the solution when you resolved yourself, so i was wondering if you can share some bits over here.
    I would have appreciated if you would have give some details - there are quite a few parameters in RZ11.  What is the technical name of the parameter you are talking about ?
    You mentioned about checking the parameter - I mean what needs to be checked, any specific values need to be there.
    Regards
    Deepak

  • Random numbers without duplicates

    Hello,
    I'm having trouble locating an explained example for selecting a set of random numbers without duplicates. Specifically, I'm working on this example from Ivor Horton's Beginning Java, chapter 3.
    3. A lottery program requires that you select six different numbers from the integers 1-49. Write a program to do this for you and generate five sets of entries.
    This is not homework, I'm just trying to teach myself Java to eventually work my way up to servlets and JSPs.
    This is what I have so far. I tried to use array sorting but it didn't work (the first three numbers in my entries was always 0), so I commented out that part. I've included sample output after the code. I don't necessarily need the exact code although that would be nice; I just need at least an explanation of how to go about making sure that if a number has been picked for an entry, not to pick it again.
    Thanks for any help,
    javahombre
    package model;
    import java.util.Random;
    import java.lang.Math.*;
    import java.util.Arrays;
    public class Lottery {
    public static void main(String[] args) {
    // Lottery example.
    // We need the following data:
    // - An integer to store the lottery number range (in this case 59).
    // - A mechanism to choose a number randomly from the range.
    // - An array to store the entries (6 different numbers per entry).
    // - A loop to generate 5 sets of entries.
    int numberRange = 59;
    int currentPick = 0;
    int[] entry = new int[6]; // For storing entries.
    //int slot = -1; // For searching entry array.
    Random rn = new Random();
    for (int n = 0; n < 5; n++)
    // Generate entry.
    for (int i = 0; i < 6; i++)
    currentPick = 1 + Math.abs(rn.nextInt()) % numberRange;
    //Arrays.sort(entry);
    //slot = Arrays.binarySearch(entry, currentPick);
    //System.out.println("i: " + i + "\t| slot: " + slot + "\t| pick: " + currentPick + "\t| compare: " + (slot < 0));
    // Add the current pick if it is not already in the entry.
    //if (slot < 0)
    entry[i] = currentPick;
    System.out.println("pick entered: " + currentPick);
    // Output entry.
    System.out.print("Entry " + (n + 1) + ": ");
    for (int j = 0; j < 6; j++)
    System.out.print(entry[j] + "\t");
    System.out.println("");
    // Set the array contents back to 0 for next entry.
    Arrays.fill(entry,0);
    Sample output (notice duplicates, as in Entry 3):
    pick entered: 11
    pick entered: 29
    pick entered: 33
    pick entered: 8
    pick entered: 14
    pick entered: 54
    Entry 1: 11     29     33     8     14     54     
    pick entered: 51
    pick entered: 46
    pick entered: 25
    pick entered: 30
    pick entered: 44
    pick entered: 22
    Entry 2: 51     46     25     30     44     22     
    pick entered: 49
    pick entered: 39
    pick entered: 9
    pick entered: 6
    pick entered: 46
    pick entered: 46
    Entry 3: 49     39     9     6     46     46     
    pick entered: 23
    pick entered: 26
    pick entered: 2
    pick entered: 21
    pick entered: 51
    pick entered: 32
    Entry 4: 23     26     2     21     51     32     
    pick entered: 27
    pick entered: 48
    pick entered: 19
    pick entered: 10
    pick entered: 8
    pick entered: 18
    Entry 5: 27     48     19     10     8     18     

    NOTE: the array reference to [ i ] seems to be misinterpreted as italics by the posting form. I've reposted the message here, hopefully it will show the code properly.
    Thanks again,
    javahombre
    Hello,
    I'm having trouble locating an explained example for
    selecting a set of random numbers without duplicates.
    Specifically, I'm working on this example from Ivor
    Horton's Beginning Java, chapter 3.
    3. A lottery program requires that you select six
    different numbers from the integers 1-49. Write a
    program to do this for you and generate five sets of
    entries.
    This is not homework, I'm just trying to teach myself
    Java to eventually work my way up to servlets and
    JSPs.
    This is what I have so far. I tried to use array
    sorting but it didn't work (the first three numbers in
    my entries was always 0), so I commented out that
    part. I've included sample output after the code. I
    don't necessarily need the exact code although that
    would be nice; I just need at least an explanation of
    how to go about making sure that if a number has been
    picked for an entry, not to pick it again.
    Thanks for any help,
    javahombre
    package model;
    import java.util.Random;
    import java.lang.Math.*;
    import java.util.Arrays;
    public class Lottery {
    public static void main(String[] args) {
    // Lottery example.
    // We need the following data:
    // - An integer to store the lottery number range (in
    this case 59).
    // - A mechanism to choose a number randomly from the
    range.
    // - An array to store the entries (6 different
    numbers per entry).
    // - A loop to generate 5 sets of entries.
    int numberRange = 59;
    int currentPick = 0;
    int[] entry = new int[6]; // For storing entries.
    //int slot = -1; // For searching entry
    array.
    Random rn = new Random();
    for (int n = 0; n < 5; n++)
    // Generate entry.
    for (int i = 0; i < 6; i++)
    currentPick = 1 + Math.abs(rn.nextInt()) %
    numberRange;
    //Arrays.sort(entry);
    //slot = Arrays.binarySearch(entry, currentPick);
    //System.out.println("i: " + i + "\t| slot: " + slot +
    "\t| pick: " + currentPick + "\t| compare: " + (slot <
    0));
    // Add the current pick if it is not already in the
    entry.
    //if (slot < 0)
    entry[ i ] = currentPick;
    System.out.println("pick entered: " + currentPick);
    // Output entry.
    System.out.print("Entry " + (n + 1) + ": ");
    for (int j = 0; j < 6; j++)
    System.out.print(entry[j] + "\t");
    System.out.println("");
    // Set the array contents back to 0 for next entry.
    Arrays.fill(entry,0);
    Sample output (notice duplicates, as in Entry 3):
    pick entered: 11
    pick entered: 29
    pick entered: 33
    pick entered: 8
    pick entered: 14
    pick entered: 54
    Entry 1: 11     29     33     8     14     54
    pick entered: 51
    pick entered: 46
    pick entered: 25
    pick entered: 30
    pick entered: 44
    pick entered: 22
    Entry 2: 51     46     25     30     44     22
    pick entered: 49
    pick entered: 39
    pick entered: 9
    pick entered: 6
    pick entered: 46
    pick entered: 46
    Entry 3: 49     39     9     6     46     46
    pick entered: 23
    pick entered: 26
    pick entered: 2
    pick entered: 21
    pick entered: 51
    pick entered: 32
    Entry 4: 23     26     2     21     51     32
    pick entered: 27
    pick entered: 48
    pick entered: 19
    pick entered: 10
    pick entered: 8
    pick entered: 18
    Entry 5: 27     48     19     10     8     18

  • ORA-00600 occurs on an extract from a large xmlType column

    When running the extract() function where search criteria has been specified (for an existing node), I receive the following error:
    ORA-00600: internal error code, arguments: [qmxdMatchingChildren:overflow-1],[], [], [], [], [], [], []
    However, if I remove the search criteria, the fragment returns no error.
    Both queries have been working successfully on smaller documents.
    Example with criteria:
    SELECT extract(tab.xml_text,'//item[@val="2.1.2.2"]') ITEM
    FROM CUR.ITEMS tab
    WHERE item_id =271;
    Example without criteria:
    SELECT extract(tab.xml_text,'//item') ITEM
    FROM CUR.ITEMS tab
    WHERE item_id =271;
    I'm estimating that the document inside the xmltype column is 4MB.
    The database is Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production With the Partitioning, OLAP and Data Mining options.

    Jennifer,
    You may be encountering the following bug:
    Bug# 3617191 See Note 3617191.8
    OERI[qmxdmatchingchildren:overflow-1] using EXTRACT from large XML document
    Fixed: 10.1.0.4, 10.2

  • Data fetch from table without Refresh and without using tab key.

    hi Friends,
    I have a problem i want to extract data from table without Refresh into text field without using Tab key. when i'll enter any value in a text field then corressponding value should come in to corressponding textfield without using Tab Key.
    eg. when i enter emp_id 101 in a text field then the first_name and last_name ,adress should come in to corressponding text fields without refresh and without using Tab key.
    How Can I do this.
    Thanks
    Manoj

    Hi Manoj,
    I assume that this is similar to: Data fetch without Refresh rather than Re: Value of one textfield should come into another textfield Without Using TAB ?
    If so, the only change you need to make on the first one is to use "onkeyup" instead of "onchange" in the item's "HTML Form Element Attributes" setting.
    Note, however, that the user must move away from the item at some point (for example, to click a button), so the onchange will be triggered anyway.
    Andy

  • Run a LabVIEW VI from VB without compiling

    I've got a couple of LabVIEW VI's that I want to run from VB without having to compile them.  I can run them fine on the development machine using:
        CreateObject("LabVIEW.Application")
    When I try this command on another machine that has the LV Runtime Engine installed it returns a run-time error "429: ActiveX component can't create component"
    I've read a few posts with similar problems however they don't seem to provide any real solutions.
    All tips/help are greatly welcome.
    Woody

    Hey Woody,
    this is an extract from a example of a VB app using LV VIs.
        'Create a reference to LabVIEW
        Set lvApp = CreateObject("ETLKWP.Application")
        'Assign an object reference to VI
        Set VI_open = lvApp.GetVIReference("ETLKWPOpenCommunication.vi")
        Set VI_close = lvApp.GetVIReference("ETLKWPCloseCommunication.vi")
        Set VI_DeviceType = lvApp.GetVIReference("ETLKWPDeviceType.vi")
    This code will load the application, here ETLKWP, and three VIs. These VIs will be found by the app on the VI search path. Since one part of the search path is "all subfolders" you can place them in any subfolder of the folder where your app is.
    Private Sub DeviceType_Click()
      Dim ParamNames(0 To 8) As String
      Dim ParamVals(0 To 8) As Variant
       ParamNames(0) = "PrimTarget"
       ParamNames(1) = "PrimIndex"
       ParamNames(2) = "Source"
       ParamNames(3) = "DeviceType"
       ParamNames(4) = "DeviceIndex"
       ParamNames(5) = "Syyy"
       ParamNames(6) = "Hyyy"
       ParamNames(7) = "SerialID"
       ParamNames(8) = "ErrorNumber"
       ParamVals(0) = PrimTarget
       ParamVals(1) = PrimIndex
       ParamVals(2) = 0
       ParamVals(3) = 81
       ParamVals(4) = 1
       Call VI_DeviceType.Call(ParamNames, ParamVals)
       SW_Stand = ParamVals(5)
       HW_Stand = ParamVals(6)
       Serienid = ParamVals(7)
    End Sub
    This part of code will call the VI DeviceType.vi. The parameters 0 - 4 are controls and 5 - 8 are indicators which are connected with the connector pane. This VI will send a message over a serial connection to an external device and the device will answer with its firmware, hardware and serial information. This information is now available in the VB program.
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • Cost Center data Extraction from R/3

    Hello,
    I am using extractor 0CO_OM_CCA_1 to get CO data into BW-BPS. After examining the resulting data into BW, I have a a problem: The customer uses movement types JVIV, RKIV, RRIV in R/3 for some of their cost centers, and they want those movements to be excluded from the extraction. However, I can see no valid filtering possibilities at the extractor....
    Do you know how I could make this filtering?
    Many thanks in advance for your help,
    Eduardo.

    Hi Gianfranco, thanks for your reply
    I am stuck at this point because when data is extracted from R/3 into BW, there is a "conversion" for such "movement types", in which the system maps those values I mentioned from table COSP_VTYPE in R/3 into something like the following in BW:
    Table RSTVTDETAIL:
    VALUETYPE MEASTYPE VTDETAIL TXTSH                TXTMD                                  
    010       001000   01       Primary Costs        Primary Costs                          
    010       001000   02       CO-Transfer          CO-Transfer                            
    010       001000   03       CO-Allocations       CO-Allocations                         
    010       001000   04       CO-Activ. alloc.     CO-Activity allocations                
    010       001000   05       CO-Settlement w act. CO-Settlement with activity flow       
    010       001000   06       CO-Settl. wo act.    CO-Settlement without activity flow    
    The problem is, I cannot find a correspondent value for those JVIV.. from R/3, and thus, all data is displayed as a total. What I intend is to separate entries related to those COSP_VTYPE values and exlude them from budgetting...
    The final objective for this one is (I will try to explain it without a specific technical knowledge of financial vocabulary), that It is a requirement that imputations to a cost center that come from other cost centers, are not displayed for the former.
    Any help will be appreciated. Thank you very much in advance
    Regards,
    Eduardo.

Maybe you are looking for

  • CAM aging time VS Port-security aging time

    Hi All Please advise on the following: - Without port-security configured, MACs per interface are learnt as "Dynamic" entries and the global CAM aging timer applies (300 seconds) unless tweaked manually. - With switchport port-security enabled (witho

  • Customize Windows 8 start screen for sysprepped image deployment.

    I am attempting to customize the start screen of a windows 8 Pro image for deployment. I have been searching and reading different threads well as technet articles but I have not found anything that works or is not completely documented. I have tried

  • How can I download the Adobe Story app on Windows. 8.1?

    I used to have it on my laptop, but now it does not want to download at all. Says "The application could not be installed because the installer file is damaged. Try obtaining a new installer file from the application author." Any idea what I can do t

  • Why is the latest version of iTunes crashing on Windows 8.1?

    The latest version crashes when connecting to the iTunes store, is there a fix for this? I'm using Windows 8.1 on my PC.

  • Storage area search for storage  type

    Hi Gurus, iam trying to create a TO  for initiainl Inventory load ( movement typer - 999), I enter the source storage type / section / Bin and dest storage type / section / Bin. Iam facing the error ' No storage area search has been defined for this