I am using array list and retuning as list i am getting class cast exceptio

Hi
below is my code
public List fun(){
List list=new ArrayList()
return(list)
public main()
List samp=xxx.fun();
its throwing a class cast exception
please help me
thnaks
sreedevi

QCDataInfo condInfo;
if(conditions!=null){
     ListIterator li = conditions.listIterator();
while (li.hasNext()) {
condInfo = (QCDataInfo) li.next();
stmt = conn.getConnection().prepareStatement(sql);
     stmt.setLong(1, JLong.forceLong(loanId));
     stmt.setString(2,condInfo.getCategory());
     stmt.setString(3,condInfo.getCleared());
     stmt.setString(4, condInfo.getMessage());
     stmt.setString(5, condInfo.getNotes());
     System.out.println(condInfo.getCategory()+"=dtstus="+condInfo.getCleared()+"=execute:="+stmt.executeUpdate());
public static List getQCDataInfo(String loanId)
throws ACTPortalException {
info = new ArrayList();
int x=0,a=0,b=0,c=0,d=0,e=0,f=0;
while(rs.next()) {
     QCDataInfo xform=new QCDataInfo();
     xform.setCategory(rs.getString("category"));
xform.setCleared(rs.getString("cleared"));
xform.setMessage(rs.getString("message"));
xform.setUpdated(rs.getString("updated"));
xform.setNotes(rs.getString("notes"));
if(rs.getString("category").equals("Occupancy")){
xform.setIndex(x);x++;
          }else if(rs.getString("category").equals("Liabilities")){
               xform.setIndex(a);a++;
          }else if(rs.getString("category").equals("Assets")){
               xform.setIndex(b);b++;                    
          }else if(rs.getString("category").equals("REO")){
               xform.setIndex(c);c++;
          }else if(rs.getString("category").equals("Collateral")){
               xform.setIndex(d);d++;
          }else if(rs.getString("category").equals("Employment and Income")){
               xform.setIndex(e);e++;
          } else if(rs.getString("category").equals("Other")){
               xform.setIndex(f);f++;
// System.out.println("data:"+rs.getString("category")+":row number:"+rs.getRow());
info.add(xform);
return (info);
the above are 2 methods where i am getting class cast exception
=21 Apr 2006 10:16:44,828 JLogger->Caught exception in AuthorizationFilter.doFilter: null
java.lang.ClassCastException
     at org.apache.struts.util.RequestUtils.lookupActionForm(RequestUtils.java:215)
     at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:181)
     at org.apache.struts.action.RequestProcessor.processActionForm(RequestProcessor.java:321)
     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:204)
     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
     at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
     at com.mindbox.app.CompressionFilter.doFilter(CompressionFilter.java:199)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
     at com.mindbox.app.DemoAccountFilter.doFilter(DemoAccountFilter.java:49)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
     at com.mindbox.app.AuthorizationFilter.doFilter(AuthorizationFilter.java:66)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
     at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
     at java.lang.Thread.run(Thread.java:534)
the above is the eeror which i am geeting when i call those methods
i thought there is a something wrong
thanks
sreedevi

Similar Messages

  • Ihave downloaded iCloud to my new PC and am using windows 7 and office 2010. I cannot get iCloud to come up on Outlook with the choices for CalendCar and contacrts, my iMail account is there, but not the general coud choices. What am I doing wrong.

    I have downloaded iCloud to my new PC and am using Windows 7 and Offie 2010. I cannot get iCloud to come up on Outlook with the choices for Calendar and Contacts, my iMail accnt is there***.me.com, but not the general Cloud choices for calendar and contacts? What am I doing wrong?

    I have I cloud 2.0.2.187 loaded just downloaded yesterday.

  • Running 5 commands using array elements and waiting between?

    Hi All,
    Trying to learn PS so please be patient with me ;)
    System: PSv3 on Win2012 server running WSUS role
    I am wanting to execute 5 commands using a 'foreach' loop but wait until one finishes before moving onto the next. Can you please check out what I have and provide some suggestions of improvement? or scrap it completely if it's rubbish :(
    Current code:
    #### SCRIPT START ####
    #Create and define array and elements
    $Array1 = @(" -CleanupObsoleteComputers"," -DeclineSupersededUpdates -DeclineExpiredUpdates"," -CleanupObsoleteUpdates"," -CleanupUnneededContentFiles"," -CompressUpdates")
    #Run the cleanup command against each element
    foreach ($element in $Array1) {
    Get-WsusServer | Invoke-WsusServerCleanup $element -Whatif
    #### SCRIPT END ####
    I am assuming that I need to use @ to explicitly define elements since my second element contains two commands with a space between?
    The cleanup command doesn't accept '-Wait' so I'm not sure how to implement a pause without just telling it to pause for x time; not really a viable solution for this as the command can sometime take quite a while. They are pretty quick now that I do
    this all the time but just want it to be future proof and fool proof so it doesn't get timeouts as reported by others.
    I have found lots of code on the net for doing this remotely and calling the .NET assemblies which is much more convoluted. I however want to run this on the server directly as a scheduled task and I want each statement to run successively so it
    doesn't max out CPU and memory, as can be the case when a single string running all of the cleanup options is passed.
    Cheers.

    Thank you all for your very helpful suggestions, I have now developed two ways of doing this. My original updated (thanks for pointing me in the right direction Fred) and Boe's tweaked for my application (blew my mind when I first read that API code
    Boe). I like the smaller log file mine creates which doesn't really matter because I am only keeping the last run data before trashing it anyway. I have also removed the verbose as I will be running it on a schedule when nobody will be accessing it anyway,
    but handy to know the verbose commands ;)
    Next question: How do I time these to see which way is more efficient?
    My Code:
    $Array1 = @("-CleanupObsoleteComputers","-DeclineSupersededUpdates","-DeclineExpiredUpdates","-CleanupObsoleteUpdates","-CleanupUnneededContentFiles","-CompressUpdates")
    $Wsus = Get-WsusServer
    [String]$Logfile = 'C:\Program Files\Update Services\LogFiles\ArrayWSUSCleanup.log'
    [String]$Logfileold = 'C:\Program Files\Update Services\LogFiles\ArrayWSUSCleanup.old'
    If (Test-Path $Logfileold){
    Remove-Item $Logfileold
    If (Test-Path $Logfile){
    Rename-Item $Logfile $Logfileold
    foreach ($Element in $Array1)
    Get-Date | Out-File -FilePath $LogFile -Append -width 50
    Write-Output "Performing: $($Element)" | Out-File -FilePath $LogFile -Append -width 100
    . Invoke-Expression "`$Wsus | Invoke-WsusServerCleanup $element" | Out-File -FilePath $LogFile -Append -width 100
    Logfile Output {added 1 to show what it looks like when items are actions}:
    Wednesday, 27 August 2014 2:14:01 PM
    Obsolete Computers Deleted:1
    Wednesday, 27 August 2014 2:14:03 PM
    Obsolete Updates Deleted:1
    Wednesday, 27 August 2014 2:14:05 PM
    Expired Updates Declined:1
    Wednesday, 27 August 2014 2:14:07 PM
    Obsolete Updates Deleted:1
    Wednesday, 27 August 2014 2:14:09 PM
    Diskspace Freed:1
    Wednesday, 27 August 2014 2:14:13 PM
    Updates Compressed:1
    Boe's Updated Code:
    [String]$WSUSServer = 'PutWSUSServerNameHere'
    [Int32]$Port = 8530 #Modify to the port your WSUS connects on
    [String]$Logfile = 'C:\Program Files\Update Services\LogFiles\APIWSUSCleanup.log'
    [String]$Logfileold = 'C:\Program Files\Update Services\LogFiles\APIWSUSCleanup.old'
    If (Test-Path $Logfileold){
    Remove-Item $Logfileold
    If (Test-Path $Logfile){
    Rename-Item $Logfile $Logfileold
    [Void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
    $Wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($WSUSServer,$False,$Port)
    $CleanupMgr = $Wsus.GetCleanupManager()
    $CleanupScope = New-Object Microsoft.UpdateServices.Administration.CleanupScope
    $Properties = ("CleanupObsoleteComputers","DeclineSupersededUpdates","DeclineExpiredUpdates","CleanupObsoleteUpdates","CleanupUnneededContentFiles","CompressUpdates")
    For ($i=0;$i -lt $Properties.Count;$i++) {
    $CleanupScope.($Properties[$i])=$True
    0..($Properties.Count-1) | Where {
    $_ -ne $i
    } | ForEach {
    $CleanupScope.($Properties[$_]) = $False
    Get-Date | Out-File -FilePath $LogFile -Append -width 50
    Write-Output "Performing: $($Properties[$i])" | Out-File -FilePath $LogFile -Append -width 100
    $CleanupMgr.PerformCleanup($CleanupScope) | Out-File -FilePath $LogFile -Append -width 200
    Logfile Output {added 1 to show what it looks like when items are actions}:
    Wednesday, 27 August 2014 2:32:30 PM
    Performing: CleanupObsoleteComputers
    SupersededUpdatesDeclined : 0
    ExpiredUpdatesDeclined    : 0
    ObsoleteUpdatesDeleted    : 0
    UpdatesCompressed         : 0
    ObsoleteComputersDeleted  : 1
    DiskSpaceFreed            : 0
    Wednesday, 27 August 2014 2:32:32 PM
    Performing: DeclineSupersededUpdates
    SupersededUpdatesDeclined : 1
    ExpiredUpdatesDeclined    : 0
    ObsoleteUpdatesDeleted    : 0
    UpdatesCompressed         : 0
    ObsoleteComputersDeleted  : 0
    DiskSpaceFreed            : 0
    Wednesday, 27 August 2014 2:32:34 PM
    Performing: DeclineExpiredUpdates
    SupersededUpdatesDeclined : 0
    ExpiredUpdatesDeclined    : 1
    ObsoleteUpdatesDeleted    : 0
    UpdatesCompressed         : 0
    ObsoleteComputersDeleted  : 0
    DiskSpaceFreed            : 0
    Wednesday, 27 August 2014 2:32:36 PM
    Performing: CleanupObsoleteUpdates
    SupersededUpdatesDeclined : 0
    ExpiredUpdatesDeclined    : 0
    ObsoleteUpdatesDeleted    : 1
    UpdatesCompressed         : 0
    ObsoleteComputersDeleted  : 0
    DiskSpaceFreed            : 0
    Wednesday, 27 August 2014 2:32:38 PM
    Performing: CleanupUnneededContentFiles
    SupersededUpdatesDeclined : 0
    ExpiredUpdatesDeclined    : 0
    ObsoleteUpdatesDeleted    : 0
    UpdatesCompressed         : 0
    ObsoleteComputersDeleted  : 0
    DiskSpaceFreed            : 1
    Wednesday, 27 August 2014 2:32:43 PM
    Performing: CompressUpdates
    SupersededUpdatesDeclined : 0
    ExpiredUpdatesDeclined    : 0
    ObsoleteUpdatesDeleted    : 0
    UpdatesCompressed         : 1
    ObsoleteComputersDeleted  : 0
    DiskSpaceFreed            : 0

  • Sum GETPIVOTDATA with multiple data item references using Array formula and cell references

    I'm trying to build a single formula referencing a shared pivot table. I would prefer not to create additional pivot tables etc.
    My criteria is basically the sum of multiple items in the pivot table. I am able to add multiple fields by typing item names in manually (see below Claims 1/2/3 etc) however I would also like to add a date range array in, but instead of typing them
    in I'd like to use cell values that can change dynamically, depending on previous options selected.
    My current formula is:
    {=SUM(IFERROR(GETPIVOTDATA("Count",'Settlement Pivots'!$A$1,"Loss Fin Year",$B6,"Scheme","Old Scheme","Month",{[Cell Range/Indirect Here...]},"Team2",{"Claims 1","Claims 2","Claims
    3","Claims 4","Claims 5","Major Claims","Claims Services"},"Scope","Settlement"),0))}
    Is this possible?
    Cheers

    Hi,
    Thank you for posting in the MSDN Forum.
    This forum is for developers disscussing issuses about VBA, VSTO and apps for Office. Since the issue is more relate to the end-user, I suggest you getting more effective response from
    Excel IT pro forum.
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thanks for your understanding.
    Best regards
    Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to use array list with fixed values to insert record in trigger

    I have a list  of number 1,30,40,45,60 . These numbers are not being changed so I  don't need to keep in a table. So have to create a  after insert trigger   for 
    As
    Begin
    @list =  1,30,40,45,60 // Array value 
    for i=1 to @list.count
    Insert into mappingtable(arrayvalue,itemcode) values (list[i],Inserted.Itemcode)
    Next
    End
    Please can you help with a code 
    Regards
    Pol
    polachan

    Be careful what you assume - rarely are lists of values like this truly static.  One thing to keep in mind that arrays in sql server are tables.  So, one example is:
    set nocount on;
    /* represents the virtual inserted table in your trigger */
    declare @inserted table (itemcode char(4));
    insert @inserted (itemcode) values ('ABCD'), ('JJKL');
    select * from @inserted;
    select * from @inserted cross join (values (1), (30), (40), (45), (60)) as arrayx(value);

  • Using a List as the value class of a Map - How?

    Hello,
    I have a managed-property of the following type
    Map<String, List<String>> myMap;How can I set the values for the List in the faces-config.xml?
    I tried sth like this, but this is no valid XML according to the schema.
    Any ideas?
    Regards,
    Jan
    <managed-property>
    <property-name>myMap</property-name>
      <property-class>java.util.TreeMap</property-class>
      <map-entries>
      <key-class>java.lang.String</key-class>
      <value-class>java.lang.ArrayList</value-class>
        <map-entry>
          <key>key1</key>
          <value>
          <list-entries>
            <value>value1</value>
            <value>value2</value>
          </list-entries>
          </value>
        </map-entry>
      </map-entries>
    </managed-property>

    You don't need a cfloop. Try an IN(...) clause instead.
    Obviously you have to validate that the #riderlist# is not empty
    first or the query will error.
    SELECT riderId,
    SUM(IIf(month(rideDate)=1, rideDistance, 0)) AS janSum,
    SUM(IIf(month(rideDate)=2, rideDistance, 0)) AS febSum,
    SUM(IIf(month(rideDate)=3, rideDistance, 0)) AS marSum,
    SUM(IIf(month(rideDate)=4, rideDistance, 0)) AS aprSum,
    SUM(IIf(month(rideDate)=5, rideDistance, 0)) AS maySum,
    SUM(IIf(month(rideDate)=6, rideDistance, 0)) AS junSum,
    SUM(IIf(month(rideDate)=7, rideDistance, 0)) AS julSum,
    SUM(IIf(month(rideDate)=8, rideDistance, 0)) AS augSum,
    SUM(IIf(month(rideDate)=9, rideDistance, 0)) AS sepSum,
    SUM(IIf(month(rideDate)=10, rideDistance, 0)) AS octSum,
    SUM(IIf(month(rideDate)=11, rideDistance, 0)) AS novSum,
    SUM(IIf(month(rideDate)=12, rideDistance, 0)) AS decSum
    FROM mileageLog
    WHERE riderId IN (<cfqueryparam value="#riderList#"
    cfsqltype="the column type here" list="true"> )
    AND Year(rideDate)=#useYear#
    GROUP BY riderId
    ORDER BY riderId

  • I'm working in Photoshop CC 2014. Why is it that when I use the refine radius tool...edges become pixelated? When using Edge Detection and sliding the radius bar I get the same result.

    I used the quick selection tool to get this far...I will be showing the result of adjusting the Radius slider...
    At 5 px you can already see the changes to the edges...
    And at 30 px...

    I've looked at this several times now, but it has me stumped! I just can't think of circumstances that might cause this.  The firs thing to try when things are properly weird is to reset Preferences (I don't think there is a reset option for refine Edge).
    Reset Preferences
    Windows — Hold down Shift Ctrl Alt immediately after starting Photoshop
    Mac — Hold down Shift Cmd Opt immediately after starting Photoshop
    I'd be interested to see the original image.

  • I am using the last mac os. safari keeps giving me gibberish fonts on random webpages, but using other browsers and other OSs I DO NOT get the gibberish.  this issue was solved by Bee who directed the user to remove duplicate fonts... where's the fix?

    On the same OS, I also use Firefox but it does not happen with firefox.  Is there a fix ???

    Have you run Font Book to check for font conflicts?

  • When can we expect a patch for Object Array List Data Provider?

    Hey JSC Team!
    When can we expect maybe, just maybe a minor patch for the Object Array List Data Provider loading class problem? Next Month? This Year? Next Year? Near Future? Long in the future? Sometime in the 22nd century?

    I think one of the problem is
    when u declare the ObjectListDataProvider in ur backing bean
    it doesnt appear in the design time straight away
    u have to clean build close and re open the project
    which is quite time consuming.

  • Insert SDO_GEOMETRY using array binding

    Hi,
    does anyone know howto insert the elem_info array and the ordinates array of a SDO_GEOMETRY object using array binding and ODP or if there is a way to insert the SDO_GEOMETRY object using the same technique.
    /Anders

    The current releases of ODP.NET do not support object types, hence no "proper" SDO_GEOMETRY support. You can retrieve the data as an XML-type as illustrated here:
    Re: ODP.Net + Spatial
    I know of no way to insert an SDO_GEOMETRY object using array binding at this time.
    If someone else has a solution, please do post!
    - Mark

  • ContainsAllFilter on array property and GreaterFilter on DateTime property

    I am very new to Coherence, trying to learn... We're using Coherence 3.7, and trying to get ContainsAllFilter on string[] property and GreaterFilter on DateTime to work. Java side implements hashCode (using Arrays.equals and RawDateTime) and equals on my POF; dotnet side also implements GetHashCode and Equals; in both cases, filters return with 0 result collection. What am I doing wrong? Thank you very much!

    Thanks for the response. I have included my Java object below.....where in this would I convert to the SQL Timestamp? Do you mean, that I would be storing the SQLTimestamp rather than RawDateTime as part of this object?
    public class RflxJournalEntry implements PortableObject {
         public RflxJournalEntry(){}
         public enum JournalOperation
              INSERT,UPDATE,DELETE;
         private JournalOperation operationType;
        private RawDateTime operationTime;
         private String process;
         private String version;
         private String username;
         private String tradeId;
        private int sequenceId;
         private RflxJournaledTrade updateList;
        private RflxTrade trade;
         @SuppressWarnings("unchecked")
         @Override
         public void readExternal(PofReader reader) throws IOException {
              setOperationType(reader.readInt(0));
              setOperationTime(reader.readRawDateTime(1));
              setProcess(reader.readString(2));
              setUsername(reader.readString(3));
              setTradeId(reader.readString(4));
              setSequenceId(reader.readInt(5));
              setUpdateList((RflxJournaledTrade)reader.readObject(6));
              setTrade((RflxTrade)reader.readObject(7));
              setVersion(reader.readString(8));
         @Override
         public void writeExternal(PofWriter writer) throws IOException {
            writer.writeInt(0, getOperationType());
            writer.writeRawDateTime(1, getOperationTime());
            writer.writeString(2, getProcess());
            writer.writeString(3, getUsername());
            writer.writeString(4, getTradeId());
            writer.writeInt(5, getSequenceId());
            writer.writeObject(6, getUpdateList());
            writer.writeObject(7, getTrade());
            writer.writeString(8, getVersion());
         public void setOperationType(int operationType) {
              this.operationType = RflxJournalEntry.JournalOperation.values()[operationType];
         public int getOperationType() {
              return operationType.ordinal();
         public void setProcess(String process) {
              this.process = process;
         public String getProcess() {
              return process;
         public void setUsername(String username) {
              this.username = username;
         public String getUsername() {
              return username;
         public void setTradeId(String tradeId) {
              this.tradeId = tradeId;
         public String getTradeId() {
              return tradeId;
         public void setOperationTime(RawDateTime operationTime) {
              this.operationTime = operationTime;
         public RawDateTime getOperationTime() {
              return operationTime;
         public void setSequenceId(int sequenceId) {
              this.sequenceId = sequenceId;
         public int getSequenceId() {
              return sequenceId;
         public void setUpdateList(RflxJournaledTrade updateList) {
              this.updateList = updateList;
         public RflxJournaledTrade getUpdateList() {
              return updateList;
         public void setTrade(RflxTrade trade) {
              this.trade = trade;
         public RflxTrade getTrade() {
              return trade;
         public void setVersion(String version) {
              this.version = version;
         public String getVersion() {
              return version;
    }

  • How to read XI Data type in Java code and populate as array list, using UDF

    Hi,
    How to read XI Data type in Java code and populate as array list, using UDF?
    Is there any API using which  the XI data types can be read?
    Kindly reply.
    Richa

    Input Structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:CustomerCreateResp xmlns:ns0="urn:bp:xi:up:re:cust_mdm:cmdm:pr5:100">
       <CUSTOMER>
          <item>
             <CUSTOMERNO/>
             <MDMCUSTOMER/>
             <CREATE_DATE/>
             <RETURN>
                <TYPE/>
                <MESSAGE/>
             </RETURN>
             <PT_CONTPART_RETURN>
                <item>
                   <MDM_CONTACT/>
                   <CONTACT/>
                </item>
             </PT_CONTPART_RETURN>
             <PARTNERS>
                <item>
                   <CUSTOMERNO/>
                   <PARTNER_FUNCTION/>
                   <PARTNER_NUMBER/>
                   <DEFAULT_PARTNER/>
                </item>
             </PARTNERS>
          </item>
       </CUSTOMER>
    </ns0:CustomerCreateResp>
    Output structure
    (Sample output structure.This actually needs to be mapped and generated using UDF)
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:updateCustomer xmlns:ns1="urn:xiSericeVi"><ns1:customer><ns2:ArrayList xmlns:ns2="java:sap/standard">[]</ns2:ArrayList></ns1:customer><ns1:name>2344566</ns1:name></ns1:updateCustomer>

  • Sort array list and using comparable

    With the following code I would like to setup a score object for the current player.
    Change it to a string(Is it correct to say parse it to a string type)
    Then add it to the arraylist.
    So I can sort the array list according to the string size.
    That's why I have the variables in that order.
    So if 3 players have the same amount of guesses, they can be positioned on the high score list according to their gameTime.
    //create score object
                   Score currentScore = new Score(guessCount, gameTime, name);
                   String currentScoreToString = currentScore.toString();
                   //add score to arrayList
                   scores.add(currentScoreToString);So the error message says " The method add(Score) in the type arrayList <Score> is not applicable for the arguments(string)"
    Now, I understand that, I would like to know if there is another way to achieve what I am trying to do.
    Is the string idea I am trying here possible? is it practical or should I use comparable?
    I have looked at comparable, but I don't get it.
    Will my Score class implement comparable. I am looking at an example with the following code.
    Employee.java
    public class Employee implements Comparable {
        int EmpID;
        String Ename;
        double Sal;
        static int i;
        public Employee() {
            EmpID = i++;
            Ename = "dont know";
            Sal = 0.0;
        public Employee(String ename, double sal) {
            EmpID = i++;
            Ename = ename;
            Sal = sal;
        public String toString() {
            return "EmpID " + EmpID + "\n" + "Ename " + Ename + "\n" + "Sal" + Sal;
        public int compareTo(Object o1) {
            if (this.Sal == ((Employee) o1).Sal)
                return 0;
            else if ((this.Sal) > ((Employee) o1).Sal)
                return 1;
            else
                return -1;
    ComparableDemo.java
    import java.util.*;
    public class ComparableDemo{
        public static void main(String[] args) {
            List ts1 = new ArrayList();
            ts1.add(new Employee ("Tom",40000.00));
            ts1.add(new Employee ("Harry",20000.00));
            ts1.add(new Employee ("Maggie",50000.00));
            ts1.add(new Employee ("Chris",70000.00));
            Collections.sort(ts1);
            Iterator itr = ts1.iterator();
            while(itr.hasNext()){
                Object element = itr.next();
                System.out.println(element + "\n");
    }The thing I don't understand is why it returns 0, 1 or -1(does it have to do with the positioning according to the object is being compared with?)
    What if I only use currentScore in a loop which loops every time the player restarts?
    //create score object
                   Score currentScore = new Score(guessCount, gameTime, name);
                   String currentScoreToString = currentScore.toString();
                   //add score to arrayList
                   scores.add(currentScoreToString);Also why there is a method compareTo, and where is it used?
    Thanks in advance.
    Edited by: Implode on Oct 7, 2009 9:27 AM
    Edited by: Implode on Oct 7, 2009 9:28 AM

    jverd wrote:
    Implode wrote:
    I have to hand in an assignment by Friday, and all I have to do still is write a method to sort the array list. Okay, if you have to write your own sort method, then the links I provided may not be that useful. They show you how to use the sort methods provided by the core API. You COULD still implement Comparable or Comparator. It would just be your sort routine calling it rather than the built-in ones.
    You have two main tasks: 1) Write a method that determines which of a pair of items is "less than" the other, and 2) Figure out a procedure for sorting a list of items.
    The basic idea is this: When you sort, you compare pairs of items, and swap them if they're out of order. The two main parts of sorting are: 1) The rules for determining which item is "less than" another and 2) Determining which pairs of items to compare. When you implement Comparable or create a Comparator, you're doing #1--defining the rules for what makes one object of your class "less than" another. Collections.sort() and other methods in the core API will call your compare() or compareTo() method on pairs of objects to produce a sorted list.
    For instance, if you have a PersonName class that consists of firstName and lastName, then your rules might be, "Compare last names. If they're different, then whichever lastName is less indicates which PersonName object is less. If they're the same, then compare firstNames." This is exactly what we do in many real-life situations. And of course the "compare lastName" and "compare firstName" steps have their own rules, which are implemented by String's compareTo method, and which basically say, "compare char by char until there's a difference or one string runs out of chars."
    Completely independent of the rules for comparing two items is the algorithm for which items get compared and possibly swapped. So, if you have 10 Whatsits (W1 through W10) in a row, and you're asked to sort them, you might do something like this:
    Compare the current W1 to each of W2 through W10 (call the current one being compared Wn). If any of them are less than W1, swap that Wn with W1 and continue on, comparing the new W1 to W(n+1) (that is, swap them, and then compare the new first item to the next one after where you just swapped.)
    Once we reach the end of the list, the item in position 1 is the "smallest".
    Now repeat the process, comparing W2 to W3 through W10, then W3 to W4 through W10, etc. After N steps, the first N positions have the correct Whatsit.
    Do you see how the comparison rules are totally independent of the algorithm we use to determine which items to compare? You can define one set of comparison rules ("which item is less?") for Whatsits, another for Strings, another for Integers, and use the same sorting algorithm on any of those types of items, as long as you use the appropriate comparison rules.Thanks ;)
    massive help
    I understand that now, but I am clueless on how to implement it.
    Edited by: Implode on Oct 7, 2009 10:56 AM

  • Adding two array lists together and a text file to an array list

    I'm having problems coding these two methods... Could someone explain how to do this? I can't find information on it anywhere... :(
    "MagazineList" is the class I'm coding in right now, and I already declared "list" as an array list of another class called "Magazine".
    public boolean addAll(MagazineList magazines)
           if (list == magazines) {
               return false;
            else {
                list.addAll(magazines);
           return true;
       public boolean addAll(String filename)
           Scanner in = ResourceUtil.openFileScanner(filename);
            if (in == null) {
               return false;
            String line = source.nextLine();
            while (!line.equals("")) {
              list.add(Magazine(source));
           in.close();
       }

    I assume "addAll(MagazineList magazines)" is defined in the MagazineList class?
    Then,
    list.addAll(magazines);probably needs to be something like:
    list.addAll(magazines.list);This uses the private variable ( should be private) list from the input MagazineList, and adds all of those Magazine objects to the list in the current MagazineList.
    But, yes, describe your problems more clearly, and you'll get better answers more quickly (because people will be able to understand you and give you a suggestion without asking you another question first).

  • Hashmap and array list problems

    This is an assignment I have to do and I do NOT expect anyone to do the coding for me. I am just looking for some direction as I have no clue where to go from here. Any guidance would be very welcomed.
    We were given code that used just an Array lisThis is an assignment I have to do and I do NOT expect anyone to do the coding for me. I am just looking for some direction as I have no clue where to go next. Any guidance would be very welcomed.
    We were given code and told to "Modify the MailServer so that it uses a HashMap to store MailItems. The keys to the HashMap should be the names of the recipients, and each value should be an ArrayList containing all the MailItems stored for that recipient. " Originally it was just an ArrayList named messages. There is also a MailClient and MailItem class.
    I think I can post the messages using the HashMap now, but can't test it. I get a compiler error saying else without if even though I have an if statement. Even if I can compile, I need to make sure I am on the right track with the getNextMailItem method. It is the one I am stuck on and if I can get it to work, I can probably modify the other methods.
    I would really appreciate feedback on that one method.
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Iterator;
    public class MailServer
         // Storage for the arbitrary number of messages to be stored
         // on the server.
         private HashMap messages;
         private ArrayList list;
         private MailItem item;
          * Construct a mail server.
         public MailServer()
             messages = new HashMap();
             list = new ArrayList();
          * Return the next message for who. Return null if there
          * are none.
          * @param who The user requesting their next message.
         public MailItem getNextMailItem(String who)
              Iterator it = list.iterator();
              while(it.hasNext())
                MailItem item = (MailItem)it.next();
                if(messages.containsKey(who));
                    return item;
               else
                   return null;
          * Add the given message to the message list.
          * @param item The mail item to be stored on the server.
         public void post(String name, MailItem item)
             if(messages.containsKey(name))
                    list = (ArrayList) messages.get(name);
                    else {
                        list = new ArrayList();
                        list.add(item);
                        messages.put(name, list);
    }[                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    The way I understand this is that MailItems are stored in per user ArrayLists, and that the ArrayLists are stored in the HashMap, and use the username as a key,
    HashMap messages = new HashMap();
    //ArrayList userMailItems = new ArrayList(); this should not be declared here, only the messages mapso given a User name, you need to get the list of mail items for that user out of the hashMap, and then return the next MailItem from the list. So given that, you don't even need to Iterate over the list:
    public MailItem getNextMailItem(String who)
    ArrayList list = (ArrayList)messages.get(who);
    if(list == null || list.size() == 0)
    return null;
    //now we get the next item from the list, we can call remove, since it returns the object we are removing.
    MailItem item = (MailItem)list.remove(0);
    return item;
    }

Maybe you are looking for

  • Windows Update on VMs seems to only work one at a time

    I have a handful of Win 2012 R2 VMs (running on ESXi) I've inherited. I've tried 3 or 4 times to update them now since taking them over, and noticed the strangest thing - only one of them will download updates at a time. If I start the update on all

  • Flash player not working in Google Reader

    My flash installation appears to be fine since youtube works perfectly along with any other website that uses flash. Here is my issue: When read an article that has an enclosed (embedded) mp3 the typical flash player that google reader uses is not sh

  • Bad Flash Player

    Adobe 11.4 doe not work mac intel snow leopard 10.6.3 .I tried to disable accelator and it will not work ,have uninstalled and reinstalled and rebooted still will not work.The previous player worked fine.I upgraded from a Power PC because it wouldn't

  • Can Validation Script Discern If a Field is Hidden?

    Hello All I use the validation script below to check for data in required fields on my form. I recently modified the form, changing three of the required fields from visible to hidden fields. The three fields are hidden unless the user makes a specif

  • Use the TV to pick the desired tune from iPod?

    I was wondering if it's possible to connect the iPod to the HiFi- system and at the same time see the library at the TV screen. It would be very easy to pick the right song.