Generic array deletion & insertion

Hello,
I was going through the options the generic Vector class offers to delete and/or insert items from/to an array, and it seems to me that the only way is by using the Splice method. For me, this method does a lot of work I dont utilize in my code (like creating a new array as a result etc.), hence
is there an optimized way how to delete a certain item from a vector, instead of calling myVector.splice(idItemToRemove,1) ?
Thanks for any answer!
Tom

that's it for array removal.  push() would be the usual method for adding elements

Similar Messages

  • Edit/delete/insert forms using php

    Hi,
    I have created an application that will allow me to
    edit/delete/insert data to my database using php.
    The functions work. But when I click on a tab i get an error
    like this:
    ypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at
    StoreManagement/runFeed()[C:\adobeStoreManagement\StoreManagement\src\StoreManagement.mxm l:26]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
    mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\co re\UIComponent.as:9051]
    at
    mx.containers::ViewStack/dispatchChangeEvent()[E:\dev\3.0.x\frameworks\projects\framework \src\mx\containers\ViewStack.as:1165]
    at
    mx.containers::ViewStack/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\containers\ViewStack.as:672]
    at
    mx.containers::TabNavigator/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework \src\mx\containers\TabNavigator.as:504]
    at
    mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\ mx\core\UIComponent.as:5670]
    at
    mx.managers::LayoutManager/validateProperties()[E:\dev\3.0.x\frameworks\projects\framewor k\src\mx\managers\LayoutManager.as:519]
    at
    mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:669]
    at Function/
    http://adobe.com/AS3/2006/builtin::apply()
    at
    mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\core\UIComponent.as:8460]
    at
    mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src \mx\core\UIComponent.as:8403]
    Also the first time I click on the edit program link it
    doesnt show any data in the combo. Then when I click on new store.
    It fills up the comboboxes. When I go back to the edit program tab.
    It now also has the data inside the combobox.
    When I add a new program, store or categorie. It says
    operation succesfull. But the new program is not added to the new
    comboboxes. I have to close the browser and rerun the application.
    Then it shows the entered value inside the comboboxes.
    I have attached all my code for this application, any help
    would be greatly appreciated. Also could you advise me on what is
    the best approach to do this?
    With friendly regards,
    Thomas

    A few things:
    * Do not use lastResult in AS code. It is intended for use in
    binding expressions only. I suspect that it is the cause of your
    error, since it will not yet exist where you are trying to
    reference it.
    * All data service calls in Flex are asynchronous. this means
    you can *never* access the result data in the same function you
    call send(), as you are attempting.
    * Use a result handler for all HTTPService calls
    * Your data model methodology is *good*, using instance vars
    to hold ArrayCollections, and binding to those vars. Just set the
    vars in a result handler, instead of in the send function
    * the default resultFormat of HTTPService is object. This
    causes Flex to convert the HTTPService XML into a tree of dynamic
    objects. While it provides a quick start, it has long term
    drawbacks. I advise setting resultFormat="e4x", so that youcan use
    the powerful e4x XML API on your data.

  • Using delete/insert mode operator target in mapping

    Hello Guys,
    Can you help me please to resolve my problem. It's very urgent.
    I use OWB 10gR2 and I create a mapping for loading data from table to table.
    I got a source table A that I want to integrate into a table B.
    I want to put my target table B on delete/insert mode to delete data from B where A.annee = B.annee
    before inserting data from A.
    How to configure this mapping.
    Thanks in advance.
    Regards.
    fanfita.

    you dont have to do anything in particular:
    on the target table propperties click on the load type as Delete/Insert and specify the column which you need to check while deleting this can be done by clicking on the column of target table in your mapping and setting the properties such as "load while insert/delete/update etc" , you got to check the delete option of the columns that you want to check while deleting.
    If your target table has sequence then delete and insert will generate new sequence id and i am not sure if there is a Foregin key which needs to be considered here so it might be a better option to use update/insert
    if there are no dependencies at all then you can go for delete/insert option.
    Edited by: Darthvader-647181 on Feb 5, 2009 1:46 AM

  • SP in delete/insert/modify trigger

    I have created a trigger which sends a notification email on deletes.inserts, or updates on a particular table.  Trigger works great.  While testing, I did a delete all - and sure enough the trigger fired on every row that was deleted and I got over 6k emails, LOL!!!  So I am thinking have this trigger call a stored proc, which then keeps up with an audit table with sysdatetime/row/count or something.  If number of rows deletetd within a certain timeframe (10seconds?) exceeds 5 then don't send any more emails.  Does this sound feasible or is there a better way?  Thanks!

    I have created a trigger which sends a notification email on deletes.inserts, or updates on a particular table.  Trigger works great
    Then you must want emails to be sent even if those DML operations fail or get rolled back. Is that true?
    If a user does the following do you really want email notifications sent?
    INSERT INTO myTable . . .;
    ROLLBACK;
    Triggers are non-transactional. They do NOT know if the work they do will ever be committed or not. Any work that a trigger does could be rolled back by Oracle or by the user.
    Unless you want email notifications sent even if that DML 'never happens', because it gets rolled back, triggers are the wrong method to use.

  • Delete inserted record

    I bulid trigger in tabel and check condition, if for example check_statment = X i need to delete inserted record (that mead not insert record) and when check_statment = Y then insert record in table, i try to write delete statment and rollback but there is error appear that the current record are reserved.
    How i can solve it.

    1. Triggers cannot Issues ROLLBACK, SAVEPOINT, COMMIT statements.
    2. I guess you are trying to avoid duplicate records, Create a unique index on the key(col1,col2) which you want to prevent duplicates on.
    3. Or you can Add a column Flag Chr(1) to your table. While inserting you allow the records to get inserted, but based on your condition change the Flag to 'D' - deleted , 'A' -active. Build a View which the user uses for application filtering out the 'D'eleted records.
    Does this look like what you are trying to do !
    Ss

  • Loading Type: DELETE/INSERT

    Hi,
    OWB 9.2.0.x
    I need to develop logic wherein the target rows would be deleted based on a condition (column value already present), and then insert new rows.
    The DELETE/INSERT Loading Type on Target is just doing a blanket delete where criteria matches and inserting fresh rows, instead of deleting just those rows that match the criteria.
    An alternative was to have a lookup, and take that to a splitter, and send matching row to a TARGET with Loading Type set to DELETE, and other set to another copy of the TARGET with Loading Type set to INSERT.
    This also does not work properly, and behaves inconsistently.
    Any help on this would be much appreciated.
    Regards
    Jojo

    To put in an example:
    We have to delete the records matching the input(staging), and then reinsert them.
    That is input records will be like
    1 a
    1 c
    5 a
    5 b
    3 a
    Target may have something like
    1 a
    1 b
    1 c
    2 a
    2 b
    3 a
    All records with first field as 1, 2 or 3 in staging should be deleted from target, and then the full staging gets inserted.
    Final target would then become
    1 a
    1 c
    2 a
    2 b
    5 a
    5 b
    3 a
    An alternate solution that comes to mind is
    Implement a delete mapping, and then do the inserts. But this would require two passes through the staging data.
    Regards
    Jojo Thomas

  • DELETE / INSERT ON A MAPPING

    Hi.
    I am doing a DELETE / INSERT on a mapping, but when I deploy it, the delete condition that generates is not the same that exists in the mapping
    i.e
    MAPPING CONDITION
    INOUTGRP1.TIME_ID
    BETWEEN
    (select TO_CHAR(FECHA_CARGA,'J') || '00' from CDW_PARAM_DWH)
    AND
    (SELECT TO_CHAR(FECHA_CARGA,'J') || '24' from cdw_param_dwh)
    * I delimited the delete range trough START DATE and END DATE
    GENERATED CONDITION
    DELETE FROM "CDW_BALANCE_A_AGG"';
    * The code generated DELETES all the table.
    What can I do?
    Thanks

    Best thing to do is delete before running the mapping in a premapping process. If you need parameters you can still use that by doing it via mapping parameters.
    In the pre mapping process you simply run a function that does the delete within the pl/sql.
    Jean-Pierre

  • DELETE/INSERT

    Hi,
    Am working on a Mapping that requires a delte insert functionality. That is, the rows in target matching a specific column should only be deleted.
    So, modified loading type to delete/insert, match by constraints to none, and then set match column when deleting to yes for the specific column
    The mapping is but doing a blanket delete. Can somebody suggest a workaround or tell where the problem is.
    OWB 9.2.0.2
    Regards
    Jojo

    OK. I have partitioned the fact table based on year and changed the loading type to TRUNCATE/INSERT. Under "Conditional Loading" I have set the 'Target Filter for Delete' to INOUTGRP1.YEAR='2004'.
    When I execute the mapping to replace data for year 2004, all the data is deleted (including the data for year 2003) and the new 2004 data is inserted. How can I just replace the data for year 2004 and leave the data for year 2003 intact?

  • Update order document through DI API generates delete / insert ?

    Hi,
    I am developing with B1 88 PL10 and I am doing an update of userfields with DI API.
    Looking on sql server profiling tool I found that  the DI API generates delete / insert instead of update statements ?
    Has someone an explanation ?
    Regards,
    Gregory

    Hi Gregory,
    There are couple of possible reasons for this. I think the most probable one is for performance and accuracy.
    Delete / insert may actually take less time than Update alone.
    Thanks,
    Gordon

  • How to split the blob byte array and insert in oracle

    how to split the blob byte array and insert in oracle
    I am having a string which is of more than lenght 4000 so i am using BLOB datatype as input to get the string.
    need to split the blob in oracle and store in the different column
    The string is of bytearray i need to strore it in each column based on the byte array.

    this will be my input i need to split the above and store it in different columns in a table.
    for spliting say
    Column1 -1 byte
    Column2-3 byte
    Column3-5 byte
    ColumnN-5 byte
    Table will have corresponding data type
    Column1 - number(10,2)
    Column2 - Float
    Column3 - Float
    ColumnN-Float
    here Column2 datatype is float but it will always have 3 byte information.
    where as Column3 datatype is also float but it will always have 5 byte information.
    Say N is Column 120

  • Looping through an array to insert contents into an HTML table

    Im trying to loop through a String array and insert the contents into an html table, unfortunately my coding is only filling in the first row in the table and ignores any additional info. Im using webservices that is connecting to a table in the database.
    Info = ID + ";" + played + ";" + won + ";" + lost + ";" is the String im pulling into my client.
    <table border = "1">
    <tr>
    <td><b>ID</b></td>
    <td><b>played</b></td>
    <td><b>won</b></td>
    <td><b>lost</b></td>
    </tr>
    <%
    try {
         leglessclient.LegendServiceService service = new leglessclient.LegendServiceService();
         leglessclient.LegendService port = service.getLegendServicePort();
    String Info = port.displayLog();
    String[] log = Info.split(";");
    out.println("<tr>");
    for (int a = 0 ; a < log.length; a++) {
    for (int b = 0 ; b < 4; b++){
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    b++;
    out.println("</tr>");
    out.println("</table>");
    } catch (Exception ex) {
         // TODO handle custom exceptions here
    %>
    Any help would be greatly appreciated
    thanks!

    firstly, if you have multiple rows.. you need to start each row with <tr> and end with a </tr>. You just have one in the beginning and end,which will obivously give data in one row.
    out.println("<tr>");
    for (int a = 0 ; a < log.length; a++) {
    for (int b = 0 ; b < 4; b++){
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    b++;
    out.println("</tr>");

  • Delete/Insert in OWB 10g

    hai,
    I wanted to use delete/insert option so that i can selectively delete data and insert
    the new set of records.But what i found is that all the existing records get deleted
    ie selective delete is not happening. Can anyone pls let me know how this can be achieved with the help of delete/insert option(in operator properties of table)
    Thanks And Regards,
    Ashir

    There is a specific Warehouse Builder forum here:
    Warehouse Builder
    You can also post questions to this forum as this forum covers all BI products. To answer your question, I am not sure what you are trying to do. Are you trying to delete the object via "Control Center"? It should be possible to deploy the job as a delete job to remove the directory from your target/source database.
    Keith Laker
    Data Warehouse Solution Architect
    Oracle EMEA Consulting
    BI Blog: http://oraclebi.blogspot.com/
    DM Blog: http://oracledmt.blogspot.com/
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    BI Samples: http://www.oracle.com/technology/products/bi/samples/

  • Xplorer X7-7700 Ctrl + FN , \ + Alt , Delete + Insert keys | SPLIT V2

    Hi SVET,
    I just purchased an MSI-1727 Barebone from a third party vendor (http://www.cyberpowerpc.com/system/Xplorer_X7_7700_Notebook/).  I did some searching and found this post and another post for the A6000 about swapping the Ctrl + FN , \ + Alt , Delete + Insert keys (to look exactly how I typed it); and that is exactly what I was looking to do.  Would it be possible if you could send me a bios that does this?  I have read the posts about how to do it, and I would definitely be willing to make a donation.
    Mainboard:  MS-1727
    PCB Version:  REV:1.0
    BIOS Version: E1727IG6.106
    BIOS Date:  2/1/2010
    EC-FW Version: 
    Thank You

    Quote from: gags1 on 16-June-10, 10:19:58
    Hi SVET,
    I just purchased an MSI-1727 Barebone from a third party vendor (http://www.cyberpowerpc.com/system/Xplorer_X7_7700_Notebook/).  I did some searching and found this post and another post for the A6000 about swapping the Ctrl + FN , \ + Alt , Delete + Insert keys (to look exactly how I typed it); and that is exactly what I was looking to do.  Would it be possible if you could send me a bios that does this?  I have read the posts about how to do it, and I would definitely be willing to make a donation.
    Mainboard:  MS-1727
    PCB Version:  REV:1.0
    BIOS Version: E1727IG6.106
    BIOS Date:  2/1/2010
    EC-FW Version: 
    Thank You
    Hello,
    The requests can be proceed on donation https://forum-en.msi.com/index.php?topic=134259.0
    Once done, the request will be e-mailed to you [up to 24 hours max]
    Best Wishes,
    Svet

  • Generic arrays

    I want to make an array of LinkedLists of Doubles. I tried:
    LinkedList<Double> buckets = new LinkedList<Double>[n];which gave me an error because I'm creating a generic array. On the other hand, if I do
    LinkedList<Double> buckets = new LinkedList[n];I get a warning suggesting that the compiler was looking for the first version!
    How do I do this?

    McNepp wrote:
    It seems to be a common misconception that one has to
    resort to Reflection in order to create arrays
    of generic types.It is not a misconception. On the contrary. It depends on what the library writer is trying to achieve. If I understand Neal Gafter in his blog http://www.gafter.com/~neal dated from September 23rd titled Puzzling Through Erasure: answer section correctly - currently his site is unavailable but you could still find cached page through Google -, that it should be fine to use reflection. Using reflection is perfectly legal if the library writer wants to design the API in such way that the type parameters are not erased. Type parameters are stored inside of the class using class literals. He says that in this case "you can instantiate using reflection (tClass.newInstance()), create arrays (Array.newInstance), cast (Class.cast), and do instanceof tests (Class.isInstance), though with a slightly different syntax than you might prefer".
    I'm still learning generics and I might be wrong.
    Best regards,
    Andrej

  • My generic array creation problem.

    I'm getting a "generic array creation" error on lines 6 and 14. I've googled it and I'm still having a hard time. Most things I find on it are pretty complicated and as you can see mine's not, I'm in a beginners course. I'm basically writing a class with methods for dealing with a file of donors.
    Here's my code:
    public class DonorList <dlist>
        //Create empty list
        public DonorList()
            storage = new dlist [MAX];
            count = 0;
        //Capacity as specified
        public DonorList (int cap)
            MAX = cap;
            storage = new dlist [MAX];
            count = 0;
        public boolean isEmpty()
            return count == 0;
        public void clear()
            count = 0;
        //Returns number of elements
        public int size()
            return count;
        //Item at position k, position starts at zero
        public dlist get (int k)
            if (k >= 0 && k < count)
                return storage [k];
            return null;
        // e becomes item at position k
        public dlist set (int k, dlist e)
            dlist old = null;
            if (k > 0 && k < count)
                    old = storage [k];
                    storage [k] = e;
            return false;
        //Returns the position of e or -1 if not found.
        public int indexOf (dlist e)
            int k;
            for (k = 0; k < count; k++)
                if (e.equals(storage[k]))
                    return k;
            return -1;
        //Appends e at the end of the list. Returns false on failure.
        public boolean append (dlist e)
            if (count < MAX)
                storage [count] = e;
                count ++;
                return true;
            return false;
        //Adds e at position k. Returns false on failure.
        public boolean add (int k, dlist e)
            int j;
            if (count == MAX || k < 0 || k > count)
                return false;
            for ( j = count; j > k; j--)
                    storage [j] = storage [j-1];
                    storage [k] = e;
                    count ++;
                    return true;
            return false;
        private int MAX = 100;
        private dlist [] storage;
        private int count;
    }Any help as to why I am getting these errors is very much appreciated. Thanks.

    You cannot create an array of a generic, instead you need to create an array of the class the generic extends (in this case Object)
    You then have to cast the array to the generic type which will give you an unchecked warning which you can turn off with @SuppressWarning("unchecked") on the class.
    Generics and arrays don't always play nicely together and this is one case. ;-)

Maybe you are looking for

  • Jsf validation

    Hi , I have got a problem here.Please help me solve this. So its like this: I have one jsp(jsf)page , it has many validators .and some validation i did manually in action method. So the problem comes when validating when i clicked the save button fir

  • New in sql developer

    Hi, I am evaluating sql developer. i tried to download the installer from http://www.oracle.com/technology/software/products/sql/index.html ( Oracle SQL Developer for Windows - 55.8MB). I followed the installation guide and explored it. I am also abl

  • Write-Behind Caching and Old Values

    Is there a way to access the old value cached in the write-behind cache for the same key from the CacheStore's store() or storeAll() method?

  • How do I hide everything except text in tabs?

    Hello - I have searched this topic and found several possible answers, but none of them seem to fully address my problem. In FF 16, how do I remove everything except text from my tabs? I don't want the activity indicator, the website icon, or even th

  • Open with - modify all

    Hi everybody, my system try to open my .pages files with Image Capture (Acquisizione Immagini in Italian), so I try with cmd+i -> open with (selecting "pages") -> modify all... Now, after I click on "modify all", in the icon-program_name return "Imag