Duplicated values when added to list of list

Hey all,
I'm making a list of lists, when I print the values just after adding in the list of list everything seems fine, but when I print that list where I call it it has duplicate value instead of the 2 different that I see when I first print it, I really don't know what's wrong.
I tried 2 different declarations for the list of list but is the same result, I also tried using index to add the list but no change either.
What is wrong? or how should I do it instead.
Thanks in advance
The code is this
public class ReadFile extends Metrics{
    public List loadFile(String filename) throws IOException{//void
        FileInputStream fstream = null;
        ///TRACE POINTS
            List<TracePoint> CharPoints=new ArrayList<TracePoint>();
            List<List> ListaChars = new ArrayList<List>();
            //List<List<TracePoint>> ListaChars = new ArrayList<List<TracePoint>>();
        try {
            fstream = new FileInputStream(filename);//"xy.dat");
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String strLine;
            Normalize norm = new Normalize();
       //Read File Line By Line
            while((strLine = br.readLine())!= null) {
                int INDEX=0;
                ///READING VALUES FROM XY FILE and splittting
                String[] temp = strLine.split(" ");
                ///clear list before reusing it
                CharPoints.clear();
                String[] tempNorm = norm.normalize(temp, 0, 1);
                for (int i = 1 ; i < tempNorm.length ; i=i+2){
                    CharPoints.add(new TracePoint(Float.parseFloat(tempNorm),Float.parseFloat(tempNorm[i+1])));
ListaChars.add(INDEX, CharPoints);
System.out.println(" Charpoints is "+ CharPoints);
System.out.println(" LISTofCHARS is "+ ListaChars);
INDEX++;
//Close the input stream
in.close();
}catch (FileNotFoundException ex) {
Logger.getLogger(ReadFile.class.getName()).log(Level.SEVERE, null, ex);
}finally {
try {
fstream.close();
} catch (IOException ex) {
Logger.getLogger(ReadFile.class.getName()).log(Level.SEVERE, null, ex);
//return CharPoints;
return ListaChars;
public static void main(String args[]) throws IOException{
ReadFile test2 = new ReadFile();
List<List> characters = new ArrayList<List>();
characters = test2.loadFile("xy.dat");
//System.out.println("\ncharacters = " +" "+ characters.get(0));
The result is this, the first look like its copying ok, but when the second is added is duplicated and the first value is not there anymoreCharpoints is [TracePoint: 0.395683, 0.913669, 0.000000, TracePoint: 0.136691, 0.928058, 0.000000, TracePoint: 0.000000, 1.000000, 0.000000]
LISTofCHARS is [[TracePoint: 0.395683, 0.913669, 0.000000, TracePoint: 0.136691, 0.928058, 0.000000, TracePoint: 0.000000, 1.000000, 0.000000]]
Charpoints is [TracePoint: 1.000000, 0.004096, 0.000000, TracePoint: 0.999937, 0.003151, 0.000000, TracePoint: 0.999811, 0.001765, 0.000000, TracePoint: 0.998866, 0.000000, 0.000000]
LISTofCHARS is [[TracePoint: 1.000000, 0.004096, 0.000000, TracePoint: 0.999937, 0.003151, 0.000000, TracePoint: 0.999811, 0.001765, 0.000000, TracePoint: 0.998866, 0.000000, 0.000000], [TracePoint: 1.000000, 0.004096, 0.000000, TracePoint: 0.999937, 0.003151, 0.000000, TracePoint: 0.999811, 0.001765, 0.000000, TracePoint: 0.998866, 0.000000, 0.000000]]
Edited by: mtiv on Oct 24, 2009 6:02 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

while((strLine = br.readLine())!= null) {
                int INDEX=0;
                INDEX++;
}On each iteration of the while loop, index equals 0. Try moving the variable index outside of the while loop.
List<TracePoint> CharPoints=new ArrayList<TracePoint>();By convention variable names begin with a lower case letter, it is an important practise to live by as I was lead to believe CharPoints was a class at first.
Mel

Similar Messages

  • How eliminating duplicated values from selecItem's List...

    Hi guys,
    i've a problem.
    I've a list of selectItem elements.
    private List<SelectItem> names;
    filled with some values.
    In this values there are some duplicated values, so i need to eliminate them.
    How can i do it?
    Please help me,thanks

    thanks very much...
    but i have a problem.
    I need to use ArrayList.
    What i want now is creating a Set and copying in it the arraylist....it should work???
    I've tried in this manner
    Once i've created the arrayList names
    i've defined
    private Set<SelectItem> names2;and i've done
    names2=new HashSet();
    names2.addAll(names);calling in my page names2.
    The problem is that it shows me the same list, with changed order, but without eliminating duplicated values.
    Can you help me?

  • How to add default values when adding custom component to design view?

    I have a set of custom components (usually) extending Spark components. But when adding our custom component onto design view, how can I define defult values (in AS3).
    For example, s:Button has default label = 'Button' when added to application, or mx:DataGrid has 3 columns predefined, but when using custom components there are no predefined values like this.
    I can put this values in constructor, but they are not visible in design time, only runtime.
    Any ideas? Thanks
    Esmin

    yes, I am. By the way I've found the solution. Someone might find this usefull.
    In design.xml having
    <component name="ExtendedTextInput" namespace="mynamespace" category="beta" displayName="ExtendedTextInput"/>
    use this
    <component name="ExtendedTextInput" namespace="mynamespace" category="beta" displayName="ExtendedTextInput">
            <defaultAttribute name="text" value="ExtendedTextInput"/>
        </component>
    so when adding this component to design view, it will have text setted to value ('ExtendedTextInput' in this case).

  • How to set Bin Location when adding Pick List by DI

    I would like to add Pick Lists by DI.
    This is Working but if i Try to Add a Bin Location by using This Code:
        oPL.Lines.BinAllocations.BinAbsEntry = Convert.ToInt32(binabs[a]);
        oPL.Lines.BinAllocations.Quantity = Convert.ToDouble( quantity[a]) ;
    i'll get iternal error -2007
    if i Update the Picklist afert addig using above mentioned code update runs without error Message but no Bin Locations are visible in Pick List.
    Picklist looks like this:

    Hi Fabian,
    SAPbobsCOM.PickLists oPickList = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
    oPickList.Lines.BaseObjectType = "17";
    oPickList.Lines.OrderEntry = 378;
    oPickList.Lines.OrderRowID = 0;
    oPickList.Lines.ReleasedQuantity = 5;
    if (oPickList.Add() != 0)
        System.Windows.Forms.MessageBox.Show("Error : " + SBO_Company.GetLastErrorDescription());
    //Screenshot 1
    if (oPickList.GetByKey(Convert.ToInt32(SBO_Company.GetNewObjectKey())))
        oPickList.Lines.BinAllocations.BinAbsEntry = 1; // 05-SYSTEM-BIN-LOCATION
        oPickList.Lines.BinAllocations.Quantity = oPickList.Lines.ReleasedQuantity;
        if (oPickList.UpdateReleasedAllocation() != 0)
            System.Windows.Forms.MessageBox.Show("Error : " + SBO_Company.GetLastErrorDescription());
    //Screenshot2
    Screenshot 1
    Screenshot 2
    regards,
    Maik

  • User or group column is populated with incorrect values when adding data from CSOM

    Hi All,
    I am working on a console application that updates list items using managed CSOM. I have a user or group column in this list that can contain multiple values. Now, I am using below code to update the value of this column:
    User newUser = web.EnsureUser("LoginName");
    context.Load(newUser);
    context.ExecuteQuery();
    FieldUserValue userValue = new FieldUserValue();
    userValue.LookupId = newUser.Id;
    listItem["User"] = userValue;
    The issue is if i assign the value of user1 to this column, the value that I see after the column is updated is another user; like user2. I don't know why it is populating this code with some other user? 
    Any idea on this issue? Thanks in advance.

    try these links:
    http://blogs.msdn.com/b/kaevans/archive/2013/11/30/setting-a-sharepoint-person-or-group-field-value-with-csom.aspx
    http://stackoverflow.com/questions/637859/sharepoint-group-by-is-broken-when-using-allow-multiple-values-for-a-column
    http://stackoverflow.com/questions/26815640/caml-person-or-group-field-with-multiple-values
    Please mark answer as correct if it is correct else vote for it if you find it useful

  • How to Get checkbox value when List value changed in classic report

    hi ,
    i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list
    take value of checkbox item and show it in message .
    SQL for report
    SELECT
    '<INPUT TYPE="checkbox" NAME="f01" VALUE="'
    ||SEQ
    ||'">' SEQ,
    ID,
    DEPT_NO,
    EMP_NAME} i change the column attributes of Dept_NO to Display as Select list of department name (named lov).
    now i want when user change name of department the value of SEQ SHOW IN ALERT MESSAGE
    i create JavaScript on the page
    function test(pThis) {
    var f01_value = $('select[name="f01"]').value;
    alert('#SEQ : '+ f01_value);
    </script>
    I call this javascript function when list change but the value undefined..
    My Question :
    How can get this value Or any value of item in reports
    regards
    Ahmed

    Hi Ahmed,
    >
    i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list
    take value of checkbox item and show it in message .
    SQL for report
    SELECT
    '<INPUT TYPE="checkbox" NAME="f01" VALUE="'
    ||SEQ
    ||'">' SEQ,
    ID,
    DEPT_NO,
    EMP_NAME} i change the column attributes of Dept_NO to Display as Select list of department name (named lov).
    >
    You should not create checkboxes like this. Either use the APEX_ITEM.CHECKBOX2 API or change the Column Type to Simple Checkbox.
    >
    now i want when user change name of department the value of SEQ SHOW IN ALERT MESSAGE
    i create JavaScript on the page
    function test(pThis) {
    var f01_value = $('select[name="f01"]').value;
    alert('#SEQ : '+ f01_value);
    </script>
    >
    name="f01" returns an array, what you need is single element value.
    Try
    <script type="text/javascript>
    function test(pThis) {
      var f01_value = $v(pThis);
       alert('#SEQ : '+ f01_value);
    </script>
    {code}
    {quote}
    I call this javascript function when list change but the value undefined..
    My Question :
    How can get this value Or any value of item in reports
    {quote}
    Depends in how you are invoking/triggering the change event. Are you using DA or have you written an "onchange" event on the element?
    Cheers,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • [svn:fx-trunk] 12542: When adding a mask to the display list need to validate it and all its children .

    Revision: 12542
    Revision: 12542
    Author:   [email protected]
    Date:     2009-12-04 10:38:32 -0800 (Fri, 04 Dec 2009)
    Log Message:
    When adding a mask to the display list need to validate it and all its children.  Previously the children were not validated and their display list was updated before properties were committed or measure was done.  RichText was not set up to handle this.
    QE notes:
    Doc notes:
    Bugs: SDK-24511
    Reviewer:  Evtim, Deepa
    Tests run: checkintests, fxg, primitives, Group
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24511
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/utils/MaskUtil.as

    AFAIK, the only way to do this is to write a system modifcation.
    The BADI is executed only once at startup of the session, so that makes it merely static. (A strange point in time, I discussed it with SAP and they just shook their heads)
    I had the same problem with some other F4-Helps and it was a big hazzle. From my experience, no straight answer.

  • When I add a new bookmark, and the (star) Page Bookmarked window appears - is there any way to expand the size of that window so that I can see my entire list of folders when adding a new bookmark to an existing folder?

    When I add a new bookmark, and the (star) Page Bookmarked window appears - is there any way to expand the size of that window so that I can see my entire list of folders when adding a new bookmark to an existing folder? The endless scrolling technique is far too tedious when trying to add a new bookmark, because the window is simply too tiny. Is there maybe a plug-in that will let me grab the corner of that window and re-size it? Thanks!

    I suggest you install the "Add Bookmark to Here2" extension, then you can expand the the list but you will not see the bookmark itself in the list if that is what you wanted. At the top you have three major folders you can select one of them and scroll up and down. Below that you have your most recently used folders and you can select one of them instead and scroll up and down. You can see the folder the bookmark is in -- they get added to the bottom
    If you really want to see the bookmark within the folder the same extension allows you to bring the bookmark to the folder from say the bookmarks sidebar that is why it is named as such. I use it but mainly i use the dialog.
    Please continue reading about bookmarks and some related extensions at
    * http://kb.mozillazine.org/Sorting_and_rearranging_bookmarks_-_Firefox
    * https://addons.mozilla.org/firefox/addon/add-bookmark-here-2/
    * http://dmcritchie.mvps.org/firefox/firefox.htm#addbookmarkhere2
    * http://dmcritchie.mvps.org/firefox/kws.htm
    If you are not using tags at all, you can remove a whole lot of confusion by removing them from the dialog via the extension.

  • How to set a default value to t-list when creating t-list programmatically

    hi,
    I'm creating a t-list programmatically
    by calling
    n = populate_group('groupname');
    populate_list('form.list','groupname');
    In this case how to set a default value for the t-list
    thanks
    rani

    I am not sure how it works in Web Dynpro for ABAP, but in Web Dynpro for Java to set default drop down value you will have to set the value for particular attribute (which is linked to the dropdown element)  in the context
    like
    wdContext.currentContext<nodeName>Element.set<FieldName>(<defalut value>)
    This generally done in Initialization method of the controller.

  • Preselected values in drop-down lists

    Hi everyone,
    Some quick background before stating the issue: I've
    developed a set of forms in ASP.NET working with a SQL Server 2000
    db where my client can add, edit, and search records within their
    intranet. When adding a record, they are making some selections
    from a drop-down list where the values are dynamically populated
    from a lookup table. There are three sections to the form and each
    section gets its values from a different table. When editing a
    record, the drop-down lists should show all the choices but
    prepopulate the list with their earlier selection.
    Here's the issue: everything is working just fine on my box
    and is working 90% on my client's server. The problem is that when
    editing a record, two of the three sections of the form are showing
    the correct values. The third section is showing the first choice
    in the drop-down list rather than what was recorded in the db.
    Again, this is not happening in my development environment.
    It's only happening on my client's environment. I've triple-checked
    the code and confirmed that the datatypes in their tables match
    what I've got set up in my db. The fact that these pages are behind
    my client's firewall make the usual trial and error kind of
    troubleshooting very difficult.
    This is very mysterious. Any suggestions for what I can check
    and how I can troubleshoot this?
    Thanks.

    In case anyone else comes across this problem, it seems that
    deleting and recreating the table solved the problem. I renamed the
    original table and compared it to the one I recreated and they
    appear to be identical but nevertheless that was the
    solution.

  • Split Values in a dropdown list

    Hi friends
    i am stuck with a problem for which i need your help.i will list it out as below.
    i am having a dropdown in my jsp page a ComboBox. The values in the dropdown are in the form
    After 10 minutes
    After 20 minutes
    After 30 minutes
    Before 5 minutes
    Now when the user selects a value in the dropdown list ex. After 10 minutes. This value needs to be fetched and i have to retrive 10 & minutes seperately from the string "After 10 minutes" and the values should go into two different colums of 2 tables in the database.
    I cannot use a DTO to set these values since the values will be combination pair of value & timetype.
    What should be my approach here.
    should i use a Hashmap or a Hashtable or some list so that i can send these values from the Action class to the Session Bean method.
    please let me know what needs to be done in this case.waiting for a positive reply from your side.
    Thanks & Regards
    Vikram K

    Create your own object which can store the different values and override the toString() method to display "After 10 Minutes" etc.
    i.e.
    private class MyClass {
       private int unit;
       private String measurement;
       public MyClass {
          super();
       // Getter and Setter Methods for fields
       public String toString() {
          return "After " + unit + " " + measurement;
    }Then you can create a custom ComboBoxModel that contains your list of custom objects. Then it's a simple case of adding an ActionListener to the ComboBox to see which object the User has selected so you can then use the getter methods to pull the info you need and populate your table.

  • Dynamically change the value of a select list in form based on a table

    Hi Friends,
    I am using a form based on a table. I want to display two fields as select lists instead of text boxes and when a value
    in a select list is selected, the corresponding values will be listed in the next select list. For example if department
    value is selected in a select list the employees in that department will be listed in the employee select list. I saw a
    metthod using ajax for achieving this in tabular form in Denes's sample application[Click Here| http://apex.oracle.com/pls/otn/f?p=31517:176:462842537250908::NO] .
    Is there any way to achieve the same for a form based on a table,
    Thanks,
    Tj

    Hi Andy,
    Could you tell me how I could use your example with multiple Application Items?
    My page has 3 cascading select lists. The second is dependent on the first and the third is dependent on both the first and second. I thought I would just need to add the second application item as a get, but not sure what the syntax would be. I have troubleshooted to the point where my select list refreshes when I have one in the javascript...just not sure how to add the additional one?
    Here's what I have (I have been referencing your 'Get Employees' page)
    My Page Items:
    P0_VENDOR_ID
    P0_VENDOR_SITE_ID
    P0_INVENTORY_ITEM_ID
    My Application Items:
    F_VDR_ID
    F_VDR_SITE_ID
    My query in the application process has both F_VDR_SITE_ID and F_VDR_ID in it.
    My javascript function...this worked OK until I added the additional get.add('F_VDR_SITE_ID')
    function getItems(filter, listName)
    var xml = null;
    var list = document.getElementById(listName);
    var listvalue = list.value;
    var get = new htmldb_Get(null,$v('pFlowId'), 'APPLICATION_PROCESS=Set_Items',4);
    get.add('F_VDR_ID', filter.value);
    get.add('F_VDR_SITE_ID', filter.value);
    ret = get.get('XML');
    if(ret)
    var s = ret.getElementsByTagName("select");
    if(s){
    var o = ret.getElementsByTagName("option");
    var oCount = o.length;
    list.options.length = 0;
    for(var i = 0; i < oCount; i++){
    var l_Opt_Xml = o;
    appendToSelect(list, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue);
    list.value = listvalue;
    if (list.selectedIndex == -1)
    list.selectedIndex = 0;
    get = null;
    Thanks,
    Janel

  • JSLink not working when using any list ViewStyles other than default.

    Hi,
    I have a custom field and i am doing client side rendering of it using JSLink for ListView form. I started by applying the JSLink in custom field class.
    public override string JSLink
    get { return myJSLinkPath; }
    set { base.JSLink = value; }
    Everything seems to work fine and i can see my custom field get rendered properly. Till this point i was using the default sharepoint list view style. After sometime i decided to use the shaded listview style which is <ViewStyle ID="17"
    /> to get the alternating row color style in my list. After applying this style, my JSLink stopped working, infact it is not even registered on page now. I have tried different ways to set JSLink property like it is mentioned in the following link but it
    didnt worked.
    http://www.martinhatch.com/2013/08/jslink-and-display-templates-part-1.html
    So my question is, how to apply JSLink while using the shaded (or any other) viewstyle?

    Arham,
    When you register your display template, I'm guessing you're using both ListTemplateID and BaseViewID in the registration code?
    It's likely that the BaseViewID is different for the Shaded ViewStyle. You should still see your code registered on the page in the Head element, but when it runs I think the registration is getting ignored.
    Using the debugger in IE or chrome should allow you to step through the Display Template registration and double check what the value of BaseViewID should be.
    You can of course override this if you want, I use a similar method in a blog post on fixing the clash with multiple web parts and JSLink on a page which may help you.
    http://www.myfatblog.co.uk/index.php/2013/09/listview-web-part-issues-with-jslink-and-display-templates-a-solution/
    I'll give this a test on my dev environment when I get home and see if I get the same results when adding the JSLink through the webpart properties.
    ##EDIT##
    Ok, I tried this at home using a Field Display Template and it worked on all the different styles, however this was with the JSLink deployed through the list view web part properties, not declaratively in the field declaration.
    It does prove however that it's not the BaseViewID causing the problem.
    ##/EDIT##
    Paul.
    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.

  • Error message when adding values to another table

    hi i have a situation where am adding values from a view to a bean,my use case is i have a list of user in my view where am adding them to my bean by clicking the button,but now i what to validate when adding a user in such a way that if i added a use in my bean and i try to add that user again in current selection i must have validating error saying the user have been added already my code is
    Edited by: adf0994 on 2012/12/13 2:19 PM

    looks like you should have asked this in the ADF-forum...
    JDeveloper and ADF
    Why don't you simply configure the user name beeing unique in your entity?
    ADF would raise an exeption for you.
    public String onRowCreate( Row currentRow ) {
    return null;
    }Don't do that.
    returning a literal null is almost ever a mistake! In this certain case you should declare you methods return type as void and ommit the return statement.
    bye
    TPD

  • How to send timer job email to "assigned to" feild value in a task list?

    Hi All,
    How to send timer job email  to "assigned to" field value in a task list if due date is after two days from now?

    Create a SharePoint Designer Workflow and use "pause until date" option when an new item is created/update.
    Using Server Object model, I believe you can create the timer job from item event receiver.
    --Cheers

Maybe you are looking for