How to iterate through a treemap in alphabetical order

This is with a servlet. I will have a button for next and previous. When next is pressed, I go to the next record in alphabetical order.
I know how to use a comparator and set it up. I also know how to use an iterator with 'hasNext' function. The problem is that the servlet(or jsp, etc...) will display this to the web. Then a doPost will get called and I have to go to the 'next' or previous record from the last time the form was called.
I don't care about concurrency yet(let me get this part down first). How do i 'track' where I was last and then go to the next record. Or is there an easier way that a treemap. I don't care about performance.

I'm assuming you want to sort on keys, not values, since that's what SortedMaps do.
Let's say you're using elements of class C as the keys in the map. Either have C implement Comparable, or create a Comparator that compares to C instances.
Whether you go the Comparable or Comparator route, the body of the compare or compareTo method will be almost the same. You'll just compare whatever fields are relevant on this/obj (Comparable) or obj1/obj2 (Comparator).
The only other difference is it's more important for Comparable's compareTo to be compatible with equals, which means you have to override equals and hashCode. You don't have to do so for Comparator, but it can make some subtle issues a bit cleaner.
Then you could do something like the following: for (Iterator iter = <something>.iterator(); iter.hasNext();) {
    <SomeClass>sc = iter.next();
    // process this element
} where <something> can be keySet() or entrySet(). Maybe even values(). I think values() will give the sorted order for a SortedMap, but not 100% sure.Check the docs. <SomeClass> will either be the class or the keys (for keySet()), Map.Entry (for entrySet()) or the class of the values (for values()).
You might want to check out this tutorial, if you haven't already.
http://java.sun.com/docs/books/tutorial/collections/

Similar Messages

  • Iterate through a treemap object

    how can 'iterate' through treemap object like you can with an ArrayLIst
    like:
    Iterator it = arraylist.iterator();

    Here is an example:
    TreeMap users = (TreeMap)session.getAttribute("users");
    Iterator i = users.entrySet().iterator();
    while (i.hasNext()) {
    Map.Entry e = (Map.Entry)i.next();
    if (e != null) {
    String key = (String)e.getKey();
    if (key != null && key.length() > 0) {
    String value = (String)e.getValue();
    } // end if key not null
    } // end if entry not null
    } // end while

  • How can I put a list in alphabetic order?

    How can I put a list in alphabetic order?

    If you don't mind putting the list in a Table, you can use the table tools to sort the rows into alphabetic order. If you don't like the idea of a table in your document and you don't want to go through converting your text to a table and back again, you can download, and install, and setup, Devon WordService, a free third party app that provides sorting and many other useful functions.
    Jerry

  • How to iterate through files in a directory in real time?

    I have a program where users can write RPN equations into txt files so that the number and type of equations are completely customizable at run time.  I need to be able to iterate through .txt files in an Equations folder to load the equations into memory.  How can I do this in real time?
    I know I could make the files eq 1.txt through eq 2.txt and iterate through until one doesn't exist, but my standard method has been to name the filename the same as the equation name.  Either way works.
    Thank you.
    Michael Chadwell
    Department of Engine and Vehicle R&D
    Southwest Research Institute

    Hi Michael,
    You could also use the GetFirstFile and GetNextFile functions that come built into CVI. These functions should allow you to iterate through the files in a directory.
    GetFirstFile: http://zone.ni.com/reference/en-XX/help/370051Y-01/cvi/libref/cvigetfirstfile/
    GetNextFile: http://zone.ni.com/reference/en-XX/help/370051Y-01/cvi/libref/cvigetnextfile/
    Hope this helps,
    Kevin

  • How to iterate through multiple records read from a file adapter?

    I am reading multiple records from a file using SyncRead file adapter.
    I want to iterate through the records to perform some action on every record. How to do this?
    I found few threads related to this..but did not get the solution.
    Please note that I am using Jdev 10.1.3.4
    Thanks

    For count expression, I am getting following error:
    <Faulthttp://schemas.oracle.com/bpel/extensionhttp://schemas.xmlsoap.org/soap/envelope/>
    <faultcode>null:subLanguageExecutionFault</faultcode>
    <faultstring>business exception</faultstring>
    <faultactor>cx-fault-actor</faultactor>
    <detail>
    <code>XPathExecutionError</code>
    <summary>XPath expression failed to execute. Error while processing xpath expression, the expression is "ora:countNodes(bpws:getVariableData('Invoke_3_SynchRead_OutputVariable','EmpCollection','/ns4:EmpCollection'))", the reason is FOTY0001: type error. Please verify the xpath query. </summary>
    </detail>
    </Fault>
    I hard-coded count, in order to proceed. Then I got following error
    <Faulthttp://schemas.oracle.com/bpel/extensionhttp://schemas.xmlsoap.org/soap/envelope/>
    <faultcode>null:bindingFault</faultcode>
    <faultstring>business exception</faultstring>
    <faultactor>cx-fault-actor</faultactor>
    <detail>
    <code>null</code>
    <summary>file:/C:/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_BPELProcess4_1.0_dc4a703c46a242f69d6cea305b2df3a3.tmp/WriteDA.wsdl [ WriteDA_ptt::insert(VbEmpCollection) ] - WSIF JCA Execute of operation 'insert' failed due to: Mapping Not Found Exception. The mapping [C1] for descriptor [class bpel___localhost_default_BPELProcess4_1_0__MD5_ad2539e1386433a9e059bcc969732f11_.WriteDA.VbEmp] could not be found. The input xml record had an element [VbEmp/C1]. ; nested exception is: ORABPEL-11627 Mapping Not Found Exception. The mapping [C1] for descriptor [class bpel___localhost_default_BPELProcess4_1_0__MD5_ad2539e1386433a9e059bcc969732f11_.WriteDA.VbEmp] could not be found. The input xml record had an element [VbEmp/C1]. Make sure that the input xml is valid relative to the xsd and that the mapping exists in the Mappings.xml. If an old version of the descriptor without this mapping has been loaded by the database adapter, you may need to bounce the app server. If the same descriptor is described in two separate Mappings.xml files, make sure both versions include this attribute/mapping. </summary>
    <detail>null</detail>
    </detail>
    </Fault>
    The bpel code is as follows (I can share entire BPEL project..But not sure how to attach to the thread :( )
    <?xml version = "1.0" encoding = "UTF-8" ?>
    <!--
    Oracle JDeveloper BPEL Designer
    Created: Wed Feb 03 18:00:26 IST 2010
    Author: administrator
    Purpose: Synchronous BPEL Process
    -->
    <process name="BPELProcess4"
    targetNamespace="http://xmlns.oracle.com/BPELProcess4"
    xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
    xmlns:ns4="http://TargetNamespace.com/InboundService"
    xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
    xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:client="http://xmlns.oracle.com/BPELProcess4"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
    xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
    xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/file/ReadFA/"
    xmlns:ehdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions"
    xmlns:ns3="http://xmlns.oracle.com/pcbpel/adapter/db/top/WriteDA"
    xmlns:ns2="http://xmlns.oracle.com/pcbpel/adapter/db/WriteDA/"
    xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
    xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc">
    <!--
    PARTNERLINKS
    List of services participating in this BPEL process
    -->
    <partnerLinks>
    <!--
    The 'client' role represents the requester of this service. It is
    used for callback. The location and correlation information associated
    with the client role are automatically set using WS-Addressing.
    -->
    <partnerLink name="client" partnerLinkType="client:BPELProcess4"
    myRole="BPELProcess4Provider"/>
    <partnerLink name="WriteDA" partnerRole="WriteDA_role"
    partnerLinkType="ns2:WriteDA_plt"/>
    <partnerLink name="ReadFA" partnerRole="SynchRead_role"
    partnerLinkType="ns1:SynchRead_plt"/>
    </partnerLinks>
    <!--
    VARIABLES
    List of messages and XML documents used within this BPEL process
    -->
    <variables>
    <!-- Reference to the message passed as input during initiation -->
    <!-- Reference to the message that will be returned to the requester-->
    <variable name="inputVariable"
    messageType="client:BPELProcess4RequestMessage"/>
    <variable name="outputVariable"
    messageType="client:BPELProcess4ResponseMessage"/>
    <variable name="Invoke_2_insert_InputVariable"
    messageType="ns2:VbEmpCollection_msg"/>
    <variable name="Invoke_3_SynchRead_InputVariable"
    messageType="ns1:Empty_msg"/>
    <variable name="Invoke_3_SynchRead_OutputVariable"
    messageType="ns1:EmpCollection_msg"/>
    <variable name="Invoke_3_SynchRead_InputVariable_1"
    messageType="ns1:Empty_msg"/>
    <variable name="Count" type="xsd:integer"/>
    <variable name="iterater" type="xsd:integer"/>
    </variables>
    <!--
    ORCHESTRATION LOGIC
    Set of activities coordinating the flow of messages across the
    services integrated within this business process
    -->
    <sequence name="main">
    <!-- Receive input from requestor. (Note: This maps to operation defined in BPELProcess4.wsdl) -->
    <receive name="receiveInput" partnerLink="client"
    portType="client:BPELProcess4" operation="process"
    variable="inputVariable" createInstance="yes"/>
    <!-- Generate reply to synchronous request -->
    <invoke name="Invoke_3" partnerLink="ReadFA" portType="ns1:SynchRead_ptt"
    operation="SynchRead"
    outputVariable="Invoke_3_SynchRead_OutputVariable"
    inputVariable="Invoke_3_SynchRead_InputVariable_1"/>
    <assign name="Assign_1">
    <copy>
    <from expression="1"/>
    <to variable="iterater"/>
    </copy>
    <copy>
    <from expression="1"/>
    <to variable="Count"/>
    </copy>
    </assign>
    <while name="While_1"
    condition="bpws:getVariableData('iterater') &lt;= bpws:getVariableData('Count')">
    <sequence name="Sequence_2">
    <switch name="Switch_1">
    <case condition="bpws:getVariableData('Invoke_3_SynchRead_OutputVariable','EmpCollection','/ns4:EmpCollection/ns4:Emp/ns4:C4') = &quot;Pune&quot;">
    <sequence name="Sequence_1">
    <assign name="Assign_3">
    <copy>
    <from expression="bpws:getVariableData('Invoke_3_SynchRead_OutputVariable','EmpCollection','/ns4:EmpCollection/ns4:Emp')[bpws:getVariableData('iterater')]"/>
    <to variable="Invoke_2_insert_InputVariable"
    part="VbEmpCollection"
    query="/ns3:VbEmpCollection/ns3:VbEmp"/>
    </copy>
    </assign>
    <invoke name="Invoke_2" partnerLink="WriteDA"
    portType="ns2:WriteDA_ptt" operation="insert"
    inputVariable="Invoke_2_insert_InputVariable"/>
    </sequence>
    </case>
    <otherwise>
    <sequence name="Sequence_3">
    <empty name="Empty_1"/>
    <assign name="Transform_1">
    <bpelx:annotation>
    <bpelx:pattern>transformation</bpelx:pattern>
    </bpelx:annotation>
    <copy>
    <from expression="ora:processXSLT('Transformation_3.xsl',bpws:getVariableData('Invoke_3_SynchRead_OutputVariable','EmpCollection'))"/>
    <to variable="Invoke_2_insert_InputVariable"
    part="VbEmpCollection"/>
    </copy>
    </assign>
    </sequence>
    </otherwise>
    </switch>
    <assign name="Assign_2">
    <copy>
    <from expression="bpws:getVariableData('iterater') + 1"/>
    <to variable="iterater"/>
    </copy>
    </assign>
    </sequence>
    </while>
    <reply name="replyOutput" partnerLink="client"
    portType="client:BPELProcess4" operation="process"
    variable="outputVariable"/>
    </sequence>
    </process>
    From the process flow, I can see that the array element expression works and the first employee record is correctly assigned to the Invoke_2_Input_Variable.
    However Invoke_2 is erroring out.
    Thanks
    Edited by: user8645981 on Feb 5, 2010 2:44 AM

  • Can anyone tell me how to iterate through a cmponent tree in JSF

    HI,
    I am new to JSF.Can any one help me in iterating through a component tree.
    For eaxmple , i have a JSF page.When i send a request for the first time for a page ,
    it will build the component tree.So i want to iterate through that component tree.
    Actullay my requirement is that in my page, i will have a datatable and some command buttons.
    when i select a row in a datatable,it should be highlighted.But again onpage load, highlighting is missing.
    So i want to save the id of the element, which i selected in the table in the request object.
    Pls help me out....

    The view root is available by FacesContext#getViewRoot(). Its getChildren() returns a List<UIComponent>. For every UIComponent you can get the children by UIComponent#getChildren() which on its turn also returns a List<UIComponent>. You can easily write a recursive method for that.

  • How to iterate through each node in REPLACE stage/XSLT transform/OSB

    I need to iterate through a xml document in a 'REPLACE' stage in a OSB message flow and have each <courseTemplate> transformed into a new xml document. The XSLT transform works correctly using the XSLT Resource Tester so I know the stylesheet works.
    ex: input data:
    <enterprise>
    <courseTemplate><sourcedId>100001-01</sourcedId><label><language>en-US</language><text>100001-01</text></label><title><language>en-US</language><text>Lower Division General Credit</text></title><catalogDescription><shortDescription>Lower Division General Credit</shortDescription><longDescription>Lower Division General Credit</longDescription></catalogDescription><courseNumber><language>en-US</language><text>XFCR 2999SA</text></courseNumber><status>Active</status><dataSource>CS</dataSource><extension><extensionField><fieldName>Mode</fieldName><fieldType>String</fieldType><fieldValue>C</fieldValue></extensionField></extension></courseTemplate>
    <courseTemplate><sourcedId>100001-02</sourcedId><label><language>en-US</language><text>100001-02</text></label><title><language>en-US</language><text>Lower Division General Credit</text></title><catalogDescription><shortDescription>Lower Division General Credit</shortDescription><longDescription>Lower Division General Credit</longDescription></catalogDescription><courseNumber><language>en-US</language><text>XFCR 2999TC</text></courseNumber><status>Active</status><dataSource>CS</dataSource><extension><extensionField><fieldName>Mode</fieldName><fieldType>String</fieldType><fieldValue>C</fieldValue></extensionField></extension></courseTemplate>
    </enterprise>
    1) the output data should look like:
    <enterprise      xsi:noNamespaceSchemaLocation="import_xml4.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <group      recstatus="2">
         <sourcedid>
         <id>100001-01</id>
         </sourcedid>
         <grouptype>
         <typevalue      level="4">Course Template</typevalue>
         </grouptype>
         <description>
         <short>100001-01</short>
         <long>Lower Division General Credit</long>
         </description>
         <relationship      relation="1">
         <sourcedid>
         <id>Uh</id>
         </sourcedid>
         <label/>
         </relationship>
         <extension>
         <path/>
         </extension>
         </group>
         <group      recstatus="2">
         <sourcedid>
         <id>100001-02</id>
         </sourcedid>
         <grouptype>
         <typevalue      level="4">Course Template</typevalue>
         </grouptype>
         <description>
         <short>100001-02</short>
         <long>Lower Division General Credit</long>
         </description>
         <relationship      relation="1">
         <sourcedid>
         <id>Uh</id>
         </sourcedid>
         <label/>
         </relationship>
         <extension>
         <path/>
         </extension>
         </group>
    </enterprise>
    2) what is happening is the first node is being repeated:
    <enterprise      xsi:noNamespaceSchemaLocation="import_xml4.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <group      recstatus="2">
         <sourcedid>
         <id>100001-01</id>
         </sourcedid>
         <grouptype>
         <typevalue      level="4">Course Template</typevalue>
         </grouptype>
         <description>
         <short>100001-01</short>
         <long>Lower Division General Credit</long>
         </description>
         <relationship      relation="1">
         <sourcedid>
         <id>Uh</id>
         </sourcedid>
         <label/>
         </relationship>
         <extension>
         <path/>
         </extension>
         </group>
         <group      recstatus="2">
         <sourcedid>
         <id>100001-01</id>
         </sourcedid>
         <grouptype>
         <typevalue      level="4">Course Template</typevalue>
         </grouptype>
         <description>
         <short>100001-01</short>
         <long>Lower Division General Credit</long>
         </description>
         <relationship      relation="1">
         <sourcedid>
         <id>Uh</id>
         </sourcedid>
         <label/>
         </relationship>
         <extension>
         <path/>
         </extension>
         </group>
    </enterprise>
    3) here is what I am using in the replace stage:
    XPath Expression Editor      : Request Pipeline - replace
    //enterprise/courseTemplate
    //enterprise/courseTemplate
    in variable: body with Xslt: SAIP_OSB_Requester/CourseTemplateSAIP_XSLT
    Input Document: $body
    Variable Names And Bindings: saipCourseTemplatesParam - $body
    4) can you see what I need to change?
    Edited by: user11960867 on Jul 5, 2011 10:58 AM

    Here is the stylesheet I am using. I wonder if it is wrong if I am working with each current node:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:output method="xml" indent="yes" />
    <xsl:variable name="saipCourseTemplates" />
    <xsl:param name="saipCourseTemplatesParam" />
         <xsl:template match="/enterprise">
              <enterprise xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="import_xml4.xsd">
                   <xsl:apply-templates select="courseTemplate" />
              </enterprise>
         </xsl:template>
         <xsl:template match="courseTemplate">
              <group recstatus="2">
                   <sourcedid>
                        <id>
                             <xsl:value-of select="sourcedId" />
                        </id>
                   </sourcedid>
                   <grouptype>
                        <typevalue level="4">Course Template</typevalue>
                   </grouptype>
                   <description>
                        <short>
                             <xsl:value-of select="sourcedId" />
                        </short>
                        <long>
                        <xsl:value-of select="catalogDescription/longDescription" disable-output-escaping="no" />
                        </long>
                   </description>
                   <relationship relation="1">
                   <sourcedid>
                   <id>Testing</id>
                   </sourcedid>
                   <label></label>
                   </relationship>
                   <extension>
                   <path></path>
                   </extension>
              </group>
         </xsl:template>
    </xsl:stylesheet>

  • How do I put my bookmarks in alphabetical order? I can use the sort by function in the organize bookmarks tab but it does not save.

    When I open the bookmark tab my bookmarks are sorted in random order. I want to open the bookmark tab and have them in alphabetical order. How do I set this as the default for bookmarks?

    See http://kb.mozillazine.org/Sorting_and_rearranging_bookmarks_-_Firefox
    SortPlaces: https://addons.mozilla.org/firefox/addon/9275

  • How do i put my songs in alphabetical order on my mac

    I've been downloading a couple songs onto my macbook air and they ar going into random order, how can i make it so that my songs are in alphabetical order?

    Are you asking about iTunes?
    In List view, click on the Name column header. In other views, there's a small Sort button in the upper-right corner of the window.

  • How do I get my 'list' in alphabetical order in PAGES

    I created a document in pages and I would like to create my list in alphabetical order,   but I can't figure it out!

    No version of Pages has an inherent sort alphabetical feature. You can put your list in table and sort the column, or you can download the free WordService tool from the OS X App Store. It contains a collection of service items including Sort Lines Ascending, that will sort a selected Pages list in place. I use it.
    WordService will get installed directly from the App Store. You only need to visit the following System Preferences panel, and as you can see from the screen shot, click the services you want enabled. This is in System Preferences ▸ Keyboard. Once your list (ending in a hard return) is selected, visit Pages ▸ Services ▸ Sort Lines Ascending. If you want to read about the individual services provided with WordService, double-click on /Applications/WordService, and choose Help. This will open Preview with a discussion of the various services.

  • How to Iterate through a BAPI table

    Hi i am calling a BAPI with the Adaptive RFC and want to store the returning information in a tree.
    For getting e.g the field URL in the current node named C_T_Nodes i can use :
    String URL =  wdContext.currentC_T_NodesElement().getUrl();
    Is that correct ?
    but that is just one entry. how can i loop through the whole list?
    Thanks, Kai

    Might this work ?
              int tableSize = wdContext.nodeReportList().size();
              String valueTable[][] = new String[tableSize][6];
              for(int i=0;i<tableSize;i++)
    valueTable<i>[0] = wdContext.nodeC_T_Nodes().getC_T_NodesElementAt(i).get<Column1>;
    valueTable<i>[1] = wdContext.nodeC_T_Nodes().getC_T_NodesElementAt(i).get<Column2>;     

  • In ios7, custom labels for phone contacts are all out of order. How can I get them back in alphabetical order?

    See above question.

    I had tried that several times with no luck.  Late last night I was finally able to get through  to the Verizon technical support who then called in Apple technical support.  It took 1 1/2 hours for them to figure it out and guide me through a fix.  So here's the deal .......... I use Yahoo mail and had left the "contacts" button in the on position.  Apparently Yahoo likes to go into your contacts and gather information and can leave it in shambles.  My advice is, go to settings, then mail, contacts, calendars.  Select any and all of your email accounts and go in and turn off their access to your information.  Leave it on for Icloud but none of the others.

  • How do I read in strings in alphabetical order nto an array?

    I've been trying this for awhile now, and I do remember seeing it in a book awhile back, but can't remember how, but I've been doing it from scratch, and it's getting long. I know the basic concept - read in the first thing to the array, after that check to see if new if smaller or bigger than last, if smaller, move it forward until the one in front(below) it is smaller, or if it hits zero. But I can't get the code very short at all... (pretty long so far and only partially working..)
    Does anyone remmeber how to do this?

    here's what I have so far:
         int findSpot(Person key)//make to just check to see if one before is smaller, if yes, -1, if no, just add to end
              int pos=0;
              Person tempPerson;
              Person tempPerson2;
         temp = new Person[MAX_ENTRIES];
              for( int index=0;index<count;index++)
                   temp[index]=phones[index];
                   System.out.println(temp[index]+ "and the index value is: " + index);
              /*need to have this read in where ever it is needed temp[count]=key;*/
              for( int index=1;index<=count;index++)
                   pos=index;
                   if((temp[pos-1].getName().compareTo(key.getName()))>0)
                        while(pos>0)
                             tempPerson2=temp[index];
                             System.out.println("PERSON2 = " + tempPerson2);
                             //System.out.println("IN WHILE!!!!!\nPOS = "+ pos);
                             tempPerson=temp[pos-1];
                             System.out.println(tempPerson.getName() + "(temp) is now assigned the value of " + temp[pos-1].getName()+ (pos-1));
                             System.out.println("\n\n temp[pos-1] = " +(pos-1) + temp[pos-1] + "\n\n");
                             System.out.println(temp[pos-1].getName()+ (pos-1) + " is assigned the value of (key)" + key.getName());
                             temp[pos-1]=key;
                             /*System.out.println(temp[pos] + ""+(pos) + "is assigned the value of (temp)" + tempPerson.getName());
                             System.out.println("\nshould be tom" + tempPerson2 + "\n");
                             //tempPerson2= tempPerson;
                             temp[pos]=tempPerson; //oh no! (vital
                             //now need to switch the su
                             while(pos>1)
                                  //tempPerson2=temp[pos-1];
                                  //System.out.println(tempPerson2.getName()+ (pos-1) + "(temp2) is assigned the value of " + temp[pos-1].getName()+ (pos-1));
                                  System.out.println(temp[pos-1].getName() + ""+(pos-1) + "is assigned the value of (temp)" + tempPerson.getName());
                                  temp[pos-1]=tempPerson;
                                  System.out.println(temp[pos].getName() + ""+(pos) + "is assigned the value of (temp2)" + tempPerson2.getName());
                                  temp[pos]=tempPerson2;//needs to be assigned 'tom'
                                  pos--;
                             pos--;
                   //else
                   //temp[index]=key;
              count++;
              for( int index=0;index<count;index++)
                   System.out.println("temp array = " + temp[index]);
                   phones[index]=temp[index];
                   return pos;
         }

  • How to get shared photo streams in alphabetical order

    presentation is now in orde of sharing.

    Shared PhotoStreams are always in the order the photos are added and cannot be rearranged - they are streams.

  • How do you iterate through a string?

    Hi! How do I loop through a string of characters. My program needs to iterate through a string in order to do some calculations. Here is an example:
    <item>1</item>
    <description>This is an example.</description>
    How I iterate through description one character at a time.
    Thanks for your help!

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
    <xsl:template name="add-X">
    <xsl:param name="string" select="." />
    <xsl:if test="$string">
    <xsl:text>X</xsl:text>
    <xsl:value-of select="substring($string, 1,1)"/>
    <xsl:call-template name="add-X">
    <xsl:with-param name="string"
    select="substring($string, 2)" />
    </xsl:call-template>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
    Create an file named TEST.xsl with the above code.
    <aaaa>ABCDE</aaaa>
    Create an file named TEST.XML with the above code.
    Create an RTF template with form field valus as
    <?import: file:///C:\Desktop\Sample RTF\TEST.xsl?>
    Note : here you have to point the xsl path where your TEST.xsl is located.
    Then create another form field with value
    <xsl:call-template name="add-X"> <xsl:value-of select="." /> </xsl:call-template>
    When you merge the xml and RTF , you will find the no of "X" equivalent to length of the string in <aaaa> tag in xml

Maybe you are looking for

  • Mobile account with FileVault

    We have a Leopard XServe 10.5.8 and a Client running Snow Leopard 10.6.2. I have just instituted via WGM the policy to create a mobile account on login and to protect the home folder with FileVault. The error I am getting is "Unable to Create mobile

  • Want to buy an external hard drive

    Hey guys, As you can see I have a Power Mac G5 (the last of the PPC models). I only have 1 internal hard drive, and want to buy an external one so i can free up some room and also be able to use it with my soon to be MacBook Pro. Would you recommend

  • HT1296 Transfer of Calendar from Phone to Computer

    I want to transfer my calendar from my phone as it is the most current to my computer. If I follow this article, will it work. I do NOT want to replace my phone's calendar with the one on my computer as it's outdated.Please advise. Thanks!

  • Grab data from files and plot on same graph

    Hello I have written some code where I ask the user how many files he or she wants to open. These files contain data in 2D format and i want to output them on the same plot. I have tried bundling them into clusters and outputting them but it hasnt wo

  • TS1717 itunes won't respond when playing movies

    itunes shuts down when I play movies but when I play my music it works, not when I play movies and I just updated to current version of itues and it was working before I updated it. Any ideals?