How to implement the RemoveLast function in a link list? check my code plz

Hi guys,
How to delete the last element in a user defined linklist. I am using the following code to find the last element of the list. It works fine, but i don't know how to remove that element ...
public Object getRear()
               rear=front;
               while (rear !=null)
                    if (rear.getNext()!=null)
                         rear=rear.getNext();
                    else
                         break; //rear Node found
               if (rear !=null) //list is not empty
                    return rear.getData();
                    return null; //list is empty
     }

Sorry, I missed out on returning the last element:
public Object delRear() {
  // I assume front is an instance field pointing to the first element
  if(front != null) {  // list contains something
    Element  rear, pred;  // I assume you have some type like this
    // determine predecessor of last element
    rear = front;
    pred = null;
    while(rear.getNext() != null) {
      pred = rear;
      rear = rear.getNext();
    if(pred == null)  front = null;  // delete only element
    else  pred.setNext(null);  // delete last element
    return  rear; // return deleted element
  else  return  null;

Similar Messages

  • How to Implement the same functionality of  IT1610  and IT1641 for CANADA

    Hi experts,
    We have done HCM Implementation to US and now moving to CANADA. We got the requirement  to create two custom OM infotypes which are similar of IT1610 and IT1641 in US specific. But when I check the functionality of IT1610, it is maitaining by calling a view T5U13. It looks like some complex logic is there behind the screen.  I am able to create basic custom infotype but not able to implement the  logic to calla a view (T5K13 in CANADA) through PP01 or PO03 and then maintain the view as well as  the infotype. How the view screen is embeded in creation of IT1610 screens.
    Could you please help me on providing the solution for this?
    Thanks for your time and waitaing for your valuable reply.
    Regards,
    Jp

    Hi Idrees,
    You need two grids and at least 3 datatable.
    Grid 1 bound to DataTable 1 - This will list all the Items, nothing special about this one.
    Grid 2 bound to DataTable 2 - This will list selected batch for current selected Item in Grid 1.
    DataTable3 - This will hold all the selected batches for all the items in Grid 1.
    Now you need to refresh DataTable 2 based on the Selected item in DataTable 1.
    When the user click on a row in DataTable 1, you need to do 2 things :
    1. Read all the records of DataTable 2 and sync it to DataTable 3.
    2. Read all the records of DataTable 3 where the Item Code belongs to the Item selected in Grid 1 populate it into DataTable2.
    Tedious, but will do the job.
    When the user click Add/Update button, write the records of DataTable1 and DataTable3 into database.
    Regards
    Edy

  • How to implement the Transfer Function in Real Time VIs?

    Hi all,
    I'm relatively new to Labview Real Time modoule and want to implement one Controller(not PID one) in Deterministic Loop! I have already designed discrete Transfer Function and searching for the way to build one Controller with it! Is it right to use the Simulation Loop instead of Timed Loop (in this case Deterministic loop) and implement the controller in it?! If it's correct so, should I use the same clock and Priod as Timed Loop?!
    It would be very helpful, if there is an Example about using transfer function in Real Time Loops!
    thanks for your help,
    Mohsen 

    Hello mhmdi,
    Sorry I can't open your VI (looks like it is a new version of LV than I have installed).
    You're right - you don't need to convert to a difference equation if you have the CD&SIM Module which can take discrete time transfer functions directly. You don't need shift registers with this function, as it is effectively done internally. If you don't have CD&SIM discrete TF's can be implemented easily just in a timed (or while) loop with feedback nodes or shift registers to replicate each z-1 you need.
    Some more ideas:
    There are many configuration parameters and options with the Discrete TF VI - which you need to understand for your application and make sure are correct. Sometimes implementing in a basic form (timed loop and shift registers) allows you to see what is happening without any confusing options you might not need.
    Are you using the Discrete TF VI in a Simulation Loop ? You might need to think if the loop being used is appropriate for a Real Time application. Maybe the timing of the TF, the loop and the DAQmx data are not all suitable for each other.
     I'm not familar with DAQmx, so not sure about any specific real-time aspetcs of that.
    "if the sample frequency of the discrete transfer function in the timed-loop is at multiple integers of the sampling rate (e.g. 12000 Hz for tranfer function and 4000 Hz for sampling rate, 12000=3*4000), would it somehow improve the resolution of the controller command?"
    This could actually make things worse - but depends on your transfer function if it is a problem. Think about it this way - in the scenario you state the input signal going into the Discrete TF will only change once in every three samples, that means if your transfer function includes a 1-z^(-1) factor (i.e. a derivative) - that will be zero for two samples then jump up for the next sample. You'll observe a very jittery/noisy signal, but the noise is due to samples not being correct. This will also occur if the sample times are very similar but go in and out of sync where you may get the occassional sample that is the same and hence the occassional zero in the TF.
    In an application I had we had problems trying to get the data coming into a timed loop and the timed loop itself synchronise, and before it was fixed the control signal was very jittery.
    Consultant Control Engineer
    www-isc-ltd.com

  • How Can implement the audit function using toplink?

    My system must record all the modification, how can I use toplink to implement it.
    I know when toplink modify some object, the toplink will check how many attribute
    have been modified, and then update it to database, Can I implement the record when
    the toplink check modification?
    PS: I dont want to use database trigger.
    Thank first!!

    This thread has been inactive for a while, so perhaps I'm missing something. I am attempting to create audit events on domain objects using a TopLink 10.1.3 DescriptorEventAdapter.
    These audit events mutate or create a snapshot collection on the domain object. Based on what I understand from the above thread, do I still need to create another UoW to commit these in my preInsert()/preCreate() handler methods?
    Is there a way to get in the game before the IDs are assigned to the objects and the change set is computed?
    I certainly don't claim to fully understand the historical client session docs. However, one of our requirements is to show object-attribute-level deltas (list chronologically, grouped by transaction, the attributes that have changed, who changed them, etc. with their before and after values). So my first-blush reaction is that it's easier to utilize the change set to create a collection of transactionally-grouped audit objects on the domain.
    Thanks much,
    --Todd Fredrich                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How  to Implement a Chained Hash Table with Linked Lists

    I'm making a migration from C/C++ to Java, and my task is to implement a Chained Hash Table with a Linked List. My problem is to put the strings(in this case names) hashed by the table using de Division Metod (H(k)= k mod N) in to a Linked list that is handling the colisions. My table has an interface implemented(public boolean insert(), public boolean findItem(), public void remove()). Any Help is needed. Thanks for everyone in advance.

    OK. you have your hash table. What you want it to do is keep key/value pairs in linked lists, so that when there is a collision, you add the key/value pair to the linked list rather than searching for free space on the table.
    This means that whenever you add an item, you hash it out, check to see if there is already a linked list and if not, create one and put it in that slot. Then in either case you add the key/value pair to the linked list if the key is not already on the linked list. If it is there you have to decide whether your requirements are to give an error or allow duplicate keys or just keep or modify one or the other (old/new).
    When you are searching for a key, you hash it out once again and check to see if there is a linked list at that slot. If there is one, look for the key and if it's there, return it and if not, or if there was no linked list at that slot, return an error.
    You aren't clear on whether you can simply use the provided linked-list implementations in the Java Collections or whether you have to cobble the linked list yourself. In any case, it's up to you.
    Is this what you're asking?
    Doug

  • How to implement a back functionally like the back of the browser

    Hi, I have a commandImageLink("go back") in a template jspx. How to implement the back functionally like the back of the browser with a managed bean method??. For know I m not using task flows.

    I think you can use a javascript method to go back to the previous browser page.
    http://javascript.about.com/library/blback.htm
    http://www.pageresource.com/jscript/jhist.htm
    http://www.w3schools.com/jsref/met_his_back.asp
    Perhaps you find something useful and related to backing beans here:
    http://adfdevelopers.blogspot.com/2009/04/some-handy-code-for-backing-beans-adf.html
    NA
    http://nickaiva.blogspot.com

  • How to implement the Oracle Group by function in Crystal reports?

    Hi all,
    In SQL, for example we have a group function like:
    select  district,state, country, continent, sum(no.of people) from world.
    Now, How to implement this group function in crystal reports? Please advise.
    Thanks in advance..
    Regards,
    sriram

    Hi Vinay,
    Thanks for the prompt reply.
    In one of our report, we are supposed to perform group by for 14 columns to get sum of 3 columns and there by displaying 17 columns in the report.
    When we tried in crystal reports to implement this oracle group by functionality:
    1. We created 14 groups from the Insert->Group option.
    2. By performing this, we got 14 group sections vertically(one inside the other).
    3. Then we created the sum(15th column),sum(16th column), sum(17th column)  by Insert->Summary option.
    4. We suppresed all the group sections except for the last group.
    5. Then, dragged all the groups to the last group section along with the summary fields.
    This is how, we tried to acheive the oracle group by function in Crystal reports.
    Please advise, whether our approach is right. If not, please suggest the appropriate approach with a bit detailed explanation.
    Thanks,
    Sriram.

  • How to implement the barcode printing functionality working on the Prod.

    Hi,
    Can anyone help me "How to implement the barcode printing functionality working on the Prod".
    Thanks
    Gangadhara

    Check this link --> barcode

  • How to Implement custom share functionality in SharePoint 2013 document Lib programmatically?

    Hi,
    I have created custom action for Share functionality in document library.
    On Share action i'm showing Model pop up with Share form with addition functionality.
    I am developing custom share functionality because there is some addition functionality related to this.
    How to Implement custom share functionality in SharePoint 2013  document Lib pro-grammatically?
    Regards,
    - Siddhehswar

    Hi Siddhehswar:
    I would suggest that you use the
    Ribbon. Because this is a flexible way for SharePoint. In my project experience, I always suggest my customers to use it. In the feature, if my customers have customization about permission then i can accomplish this as soon
    as possible. Simple put, I utilize this perfect mechanism to resolve our complex project requirement. Maybe we customize Upload/ Edit/ Modify/ Barcode/ Send mail etc... For example:
    We customize <Edit> Ribbon. As shown below.
    When user click <Edit Item>, the system will
    render customized pop up window.
    Will

  • How to implement the search help exit to MM01 for Material by product hiera

    Hi,
    How to implement the search help exit to MM01 T-code for Material by product hierarchy,
    but system default it gives the data from MVKE table, my client wants from MARA table,
    i created the one Function Module, write this code in that FM.
    IF CALLCONTROL-STEP EQ 'DISP'.
    REFRESH RECORD_TAB.
    SELECT * FROM MARA INTO TABLE RECORD_TAB
    WHERE PRDHA = 
    ENDIF.
    I Face the problem what variable i have to pass in WHERE CONDITION, FROM THE MM01 T-code.
    is't require to IMPORT variable from MM01 program, what is that import variable, please give me the solution.
    thanks to all.

    Hi there..
    check my web blog on search help exit...
    [Search help exit code|https://wiki.sdn.sap.com/wiki/x/du0]

  • How to implement Shopping cart functionality in weblogic portal 10.3

    Hi,
    Can someone help me out on how to implement Shopping cart functionality in weblogic portal 10.3?
    Thanks,
    Uttam

    One piece of advise I can give is to NOT* use the Shopping Cart fuctnionality inherent in WLP (com.beasys.commerce.ebusiness.shoppingcart. The Online Commerce functionality in WebLogic Portal has been deprecated.
    Brad

  • How XAI implements 'get more' function in CC&B pages

    Hi all,
    There is a 'get more' button in CC&B page if you list more than 50 records, just clicking the button when I wanna get last records , but how should i implement the same function by XAI, I have researched much time about this issue and gotten nothing. so had Anybody here encounterd the same issue? and have solved it?
    any help would be appreciated.

    The get more function works in the browser becuase there is a seperate "list" servlet which retrievs the data. It relies on certain HTTP context data for correct operation. Unfortunately the "get more" function is not supported by the XAI Servlet (it does not about the HTTP context data). Your only option is to roll your own paging mechnaism for the data you require.
    The pattern goes likes this...
    1. Work out the SQL for what you want to paginate
    2. Create a new "List Service" class that will act as the underlying service
    3. Annotate the service with inputs which include the page size, and the page number you want to retrieve
    4. Annotate the service with a list data that will be returned
    5. Use the page size and page number to create and execute the query and build the return result
    6. Register the service as an XAI Inbound Service
    7. Deploy the code
    8. Test using Dynamic Submission
    eg. Here is an example of Get More for Lookup Values....
    import com.splwg.base.api.BusinessEntity;
    import com.splwg.base.api.SimpleEntityList;
    import com.splwg.base.api.service.DataElement;
    import com.splwg.base.api.service.ItemList;
    import com.splwg.base.api.service.ListBody;
    import com.splwg.base.domain.common.lookup.LookupField_Id;
    import com.splwg.base.domain.common.lookup.LookupValue;
    import com.splwg.base.domain.common.lookup.LookupValue_Id;
    import com.splwg.base.support.service.metainfo.ListBodyField;
    import com.splwg.shared.environ.ServiceListConstant;
    import com.splwg.shared.logging.Logger;
    import com.splwg.shared.logging.LoggerFactory;
    * @author edhoi
    @ListService (name = CmGetMoreListValues, size = 10000, program = CMLGETMRL, service = CMLGETMRL,
    * body = @DataElement (contents = { @DataField (name = COUNTER)
    * , @RowField (entity = lookupValue, name = lookupValue)}),
    * headerFields = { @DataField (name = ELEM_SIZE)
    * , @DataField (name = FIELD_NAME)
    * , @DataField (name = FIELD_VALUE)})
    public class CmGetMoreListMaintenance extends CmGetMoreListMaintenance_Gen {
         private static final Logger LOG = LoggerFactory.getLogger(CmGetMoreListMaintenance.class);
         @Override
         protected ItemList<DataElement> readList() {
              // Call CmGetMoreBusinessComponent
              CmGetMoreBusinessComponent cmGetMoreBusinessComponent = CmGetMoreBusinessComponent.Factory
                        .newInstance();
              LookupField_Id lookupField_Id = new LookupField_Id(getHeader().get(
                        CmGetMoreListMaintenance.STRUCTURE.HEADER.FIELD_NAME));
              LookupValue_Id lookupValueId = new LookupValue_Id(lookupField_Id,
                        getHeader().get(
                                  CmGetMoreListMaintenance.STRUCTURE.HEADER.FIELD_VALUE));
              BigInteger pageSize = getHeader().get(
                        CmGetMoreListMaintenance.STRUCTURE.HEADER.ELEM_SIZE);
              LookupValue lastValue = lookupValueId.getEntity();
              List<LookupValue> values = cmGetMoreBusinessComponent
                        .getLookupValuePageData(lookupField_Id, lastValue, pageSize
                                  .intValue());
              long count = cmGetMoreBusinessComponent
                        .countLookupValues(lookupField_Id);
              if (values.size() > 0) {
                   lastValue = values.get(values.size() - 1);
              } else {
                   lastValue = null;
              ItemList<DataElement> itemList = new ItemList<DataElement>(CmGetMoreListMaintenance.STRUCTURE.list_CmGetMoreListValues.name);
              ListBody listBody = itemList.newListBody();
              listBody.put(CmGetMoreListMaintenance.STRUCTURE.list_CmGetMoreListValues.COUNTER, new BigInteger(
                        Long.toString(count)));
              if(lastValue != null) {
                   listBody.put(CmGetMoreListMaintenance.STRUCTURE.list_CmGetMoreListValues.FIELD_VALUE, lastValue.getId().getFieldValue());
              for (LookupValue value : values) {
                   DataElement listElement= itemList.newDataElement();
                   listElement.addRow(value.getDTO());
              return itemList;
         @Override
         protected void afterPopulateList_CmGetMoreListValues(
                   ItemList<DataElement> targetList, SimpleEntityList sourceList,
                   BusinessEntity sourceListParent) {
              // TODO Auto-generated method stub
              super.afterPopulateList_CmGetMoreListValues(targetList, sourceList,
                        sourceListParent);
    }

  • How to remove the sort function on the drill down and then save

    how to remove the sort function on the drill down and then save in the  change local view of the Query
    Is it possible to change the porperties of any characteristic in the local view and then save?
    If so please post the answer.

    I do not think that option is possible.
    Regards,
    Venkata Boga.

  • Does anyone know how to use the bcc functionality for apple mail while accessing it on the cloud from my PC?

    I am currently away from my MAC and want to send an email through apple mail with the bcc functionality.  I am using the cloud to get to my mail, however, I can't figure out how to use the BCC functionality, please help.  Thanks!

    Open your mail,
    lower left corner click on settings,
    go to composing and check BCC, save and your done

  • How to Use the language function for assignment and validation

    Hi All,
    If anyone can explain me in details with example ,how to use the language function for assignments and validations?
    Thanks
    Arnab

    Hi Arnab,
    The expression is checked only for the current MDM session.
    If u login with the ABC language it will always show the ABC language no matter how many times u execute it.
    Try connecting to the DM with the XYZ language.
    It should go to the if part rather than else.
    Hope it helps.
    Thanks,
    Minaz

Maybe you are looking for

  • HT204382 I have a file which I cannot open onb my computer.   Would anyone know how to open a file with name ending in "flv"?

    I have a few files on my computer which I cannot open.   The file name ends in "flv"   Can anyone help with this?

  • CLM customizing for SD/MM Orders

    Hi Experts! What do I customize in CLM through SPRO transaction in order to make the cash flow consider the contracts in MM and SD? The customizing I have achieved so far, allow the system to take only MM PO's and SD SO's into cash flow figures. Than

  • Idoc to XI - Error

    Hi I'm trying to get an Idoc WP_PLU02 from the SAP Retail system to XI. The RFC destination, port & partner profile are all setup. I tried to process the IDoc from WE19, I can see a successful Idoc in WE02 with status 3 (sent to an external system).

  • Weird WebUtil Error.

    I am attempting to test WebUtil "client_host" on an HP-UX 9iAS install. I have created a form that has a command line that I can enter the command I want to run and a button to run it. I have sucessfully tested this form on both a Windows 9iDS and 9i

  • Reg User Exit SUSR0001

    Hi all,    Facing problem with user exit SUSR0001.     When we login through GUI control is flowing through the exit, but when we login through RFC, control is not flowing through the exit.   Wt to do if we want need any validation while we login thr