Unchecked call to to add(E) ....... HELP

Hi, i was doing a project in eclipse, and everything was fine (compiled and running). However, I ran into this problem when I try to compile the same code in DOS command line. Is there any ways that I can fix this problem so the same code that runs in Eclipse can compile in DOS also?
a glimpse of the code is below:
ArrayList best_move  = new ArrayList();
for ( ..r... )
   for( ..c.... )
       Move  move = new Move( r, c);
       if( move is valid )
            then
                best_move.add(move);warning: [unchecked] unchecked call to add(E) as a
member of
the raw type java.util.ArrayList
best_move.add((Move) move);Appreciate your help.

try the following
ArrayList<class name> best_move  = new ArrayList<class name>();
for ( ..r... )
   for( ..c.... )
       Move  move = new Move( r, c);
       if( move is valid )
            then
                best_move.add((class name)move);in above "class name" is the class of the object which u wanna store in the collection e.g java.lang.Integer or java.lang.Float etc.
this will not give any warnings in jdk1.5 and will help u out.

Similar Messages

  • Unchecked call to add element

    I get the following warning:
    warning: [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector
    from the line:
    ((Vector)results.get( "ALL" )).addElement( new Result( date, home, hg, ag, away ) ) ;I have had no problems fixing this warning with simple lines like:
    private Hashtable<String,Object> results = new Hashtable<String,Object>() ;but as you can see it is a bit more tricky.
    The compiler highlights:
    ( new Result( date, home, hg, ag, away ) ) ;as the warning. The Result Object takes parameters <String,String,Integer,Integer,String> if that helps.
    Can anyone suggest how to fix this warning please?

    Are all values in your hastable vectors of results, or will that only be true when the key is "ALL". If they all contain Vectors you can rewrite the code as follows
    private Hashtable<String, Vector<Result>> results = new Hashtable<String, Vector<Result>>();
    results.put("ALL", new Vector<Result>());
    results.get("ALL").addElement(new Result (date, home, hg, ag, away));Or if you want to keep your code more flexible change Vector to it's interface List. That will reduce the amount of work you have to do if you decide you don't want to use Vectors any more and use ArrayLists.
    private Hashtable<String, List<Result>> results = new Hashtable<String, List<Result>>();
    results.put("ALL", new Vector<Result>());
    results.get("ALL").add(new Result (date, home, hg, ag, away));Of course none of this will work if your map contains values other than Vectors of results.

  • JDK 6: Generics: List.add() question - keep getting unchecked call warning.

    JDK 6
    Generics
    private TreeNode transactionTreeData;
    transactionTreeData.getChildren().add(moduleData);1. transactionTreeData is a TreeNode.
    2. the method getChildren() returns a java.util.List
    3. the method add() is from the Collection interface.
    I keep returning the warning message:
    "unchecked call to add(E) as a member of the raw type java.util.List"
    I understand what this means, but I am having problems rewriting these lines correctly to remove the warning.
    I've tried:
    private TreeNode transactionTreeData;
    List<TreeNode> treeList = transactionTreeData.getChildren();
    treeList.add(moduleData);But I keep returning the same warning message. I guess what is throwing me off is how to I properly add the generic statements when the List is return from a method (getChilden in this example)?
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    This is actually JSF - MyFaces Tomahawk to be exact, my mistake for not adding that in my original thread.
    I am dealing with the compiled class:
    package org.apache.myfaces.custom.tree2;
    public interface TreeNode extends java.io.Serializable {  
         java.util.List getChildren();
    }TreeNode.getChildren return a raw List as you can see, no doubt...
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to add F4 help for the custom field of a custom table

    Hi All,
    How to add F4 help to the custom table field? in the table maintainance when user clicks on F4 i want to provide possible values for this field I am trying to write the code in the screen of table maintainace like the following
    PROCESS ON VALUE-REQUEST.
      FIELD ZTEST_MAH_F4-KUNNR MODULE zVALUE_kunnr .
    But when i am double clicking on module it's giving options to create include program but after that it's giving user is currently editing the table i am not getting this can some body clarify my doubt it's gr8 if some body give some examp code
    Thanks&Regards
    mahesh

    Hi,
    Create a subroutine under the event and call the following FM
    1. Select all the related data into an itab, for ex i_kunnr
    2.    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
        DDIC_STRUCTURE         = ' '
           retfield               = 'KUNNR'
        PVALKEY                = ' '
           dynpprog               = sy-repid
           dynpnr                 = '1000'
           dynprofield            = <selection screen field>
        STEPL                  = 0
        WINDOW_TITLE           =
        VALUE                  = ' '
           value_org              = 'S'
        MULTIPLE_CHOICE        = ' '
        DISPLAY                = ' '
        CALLBACK_PROGRAM       = ' '
        CALLBACK_FORM          = ' '
        MARK_TAB               =
      IMPORTING
        USER_RESET             =
          TABLES
           value_tab              = <b>i_kunnr</b>
        FIELD_TAB              =
           return_tab             = < return table >
        DYNPFLD_MAPPING        =
         EXCEPTIONS
           parameter_error        = 1
           no_values_found        = 2
           OTHERS                 = 3

  • Unchecked Call to addElement(E)

    I'm trying to store AudioClip objects in a vector. It compiles with a warning:
    AudioHolder.java:19: warning: [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector
              soundVector.addElement(temp);
    Temp is an AudioClip, but even when I make it something simple like an int or a String, it still throws up the same warning. At runtime, the line of code comes up with a nullpointer error. Can someone help me figure out how to fix this?

    The unchecked warning is just that: a warning, which you can safely ignore. All it's saying is that you could have taken advantage of the greater type-safety provided by jdk1.5 generics, for example:  Vector<AudioClip> soundVector = new Vector<AudioClip>();
      AudioClip temp = getAudioClip(); // or whatever
      soundVector.addElement(temp);  // no warningThe NullPointerException is not related to the unchecked warning. You probably tried to call a method or access a field on a null reference.

  • How to add F1 help for a field

    hello.
    could you plese send me a small program , add F1 help for a field ,
    it's very urgent !
    best regards
    srinivas

    data: it_ret like ddshretval occurs 0 with header line,
             IT_MSEG_TEMP LIKE IT_MSEG OCCURS 0 WITH HEADER LINE.
    At selection-screen on value-request for s_mat-low.
      Select MBLNR from mkpf into table it_mblnr.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
      DDIC_STRUCTURE         = ' '
          RETFIELD               = 'MBLNR'
      PVALKEY                = ' '
      DYNPPROG               = ' '
      DYNPNR                 = ' '
      DYNPROFIELD            = ' '
      STEPL                  = 0
      WINDOW_TITLE           =
      VALUE                  = ' '
         VALUE_ORG              = 'S'
      MULTIPLE_CHOICE        = ' '
      DISPLAY                = ' '
      CALLBACK_PROGRAM       = ' '
      CALLBACK_FORM          = ' '
      MARK_TAB               =
    IMPORTING
      USER_RESET             =
        TABLES
          VALUE_TAB              = IT_MBLNR
      FIELD_TAB              =
         RETURN_TAB             = IT_RET
      DYNPFLD_MAPPING        =
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF SY-SUBRC = 0.
        read table it_ret index 1.
        move it_ret-fieldval to S_mat-low.
      ENDIF.
    At selection-screen on value-request for s_mat-high.
      Select MBLNR from mkpf into table it_mblnr.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
      DDIC_STRUCTURE         = ' '
          RETFIELD               = 'MBLNR'
      PVALKEY                = ' '
      DYNPPROG               = ' '
      DYNPNR                 = ' '
      DYNPROFIELD            = ' '
      STEPL                  = 0
      WINDOW_TITLE           =
      VALUE                  = ' '
         VALUE_ORG              = 'S'
      MULTIPLE_CHOICE        = ' '
      DISPLAY                = ' '
      CALLBACK_PROGRAM       = ' '
      CALLBACK_FORM          = ' '
      MARK_TAB               =
    IMPORTING
      USER_RESET             =
        TABLES
          VALUE_TAB              = IT_MBLNR
      FIELD_TAB              =
         RETURN_TAB             = IT_RET
      DYNPFLD_MAPPING        =
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF SY-SUBRC = 0.
        read table it_ret index 1.
        move it_ret-fieldval to S_mat-high.
      ENDIF.

  • How to add search help to a report.

    How to add search help to a report.

    Hi
    It can use the event AT SELECTION-SCREEN ON VALUE REQUEST:
    PARAMETERS: P_FIELD LIKE ....
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FIELD.
    * Here it needs to insert the abap code to call the search help,
    * for example it can call fm F4IF_FIELD_VALUE_REQUEST
      CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
           EXPORTING
               TABNAME        = SPACE
                SEARCHHELP = <SEARCH HELP>
                DYNPPROG     = SY-REPID
                DYNPNR          = SY-DYNNR
                DYNPROFIELD = 'P_FIELD'.
    Max

  • Removing unchecked call warnings

    I have moved from 1.4.2 to 1.5.0 today, and now I'm trying to solve all the unchecked call warnings that I had in the code, but I have one that I don't know how to avoid it.
    I need a matrix of nxn dimensions where every element is an Integer. I was creating this matrix in a recursive way, with a recursion deep of n. For example, if n=3, I had finally a Vector<Vector<Vector<Vector<Integer> > > >. As n is configurable by the user, I can't determine the data types that i must declare in the recursive calls that I use to manage the matrix.
    There is a class to implement my "matrix" in a simplest way?
    If not, there is a way to remove the warnings in the recursive calls?
    If not, I suppose that I must keep the warnings...
    Jorge

    Well, my use of the matrix is not mathematical but to represent the "real world".
    I'm working in the project previous to the University graduation, and I'm implementing a communication protocol among different computers.
    Those computers are linked in n dimensions (I have let configurable the dimensions because I think that flexibility is important for things like this).
    If n=1, the computers are linked like this:
    A - B - C -D - E -F - G - H - J
    If I have n = 2 the computers are linked like this:
    A - B - C
    | \ | / |
    D - E - F
    | / | \ |
    G - H - J
    (Well, in the post preview this last configuration looks very bad because some spaces are trim: The "E" computer is linked to all the rest of computers)
    If I have n = 3 the computers are linked in a cube shape, if I have n = 4 in an hipercube, and so on.
    That's why I need a multidimensional matrix to represent my network.
    I have a class that encapsulates the access to all the linked neighbours of a computer, and internally it stores these neighbours as a Vector of Vector's. of Vector's...(n times)
    For example, to create all the neighbour objects, I must write code like this:
    private Vector neighbours; // I don't know what I must write inside <> next to Vector declaration
    neighbours = new Vector(LINKS_IN_DIMENSION); // Again, the warning complains the lack of <>, but I don't know what goes inside
    initializeDimensionVector(1, neighbours);
    // In the method declaration, I need again the <> specification but is not possible
    private void initializeDimensionVector(int dimension, Vector vecDimension)
         vecDimension.setSize(LINKS_IN_DIMENSION);
         if ( NET_DIMENSIONS == dimension )
              for ( int i = 0; i < LINKS_IN_DIMENSION; ++i )
              vecDimension.setElementAt(new NeighbourDirectlyConnected(), i);
              return;
         for ( int i = 0; i < LINKS_IN_DIMENSION; ++i )
              // And finally here, for the new recursive call, the unspecified Vector declaration appears again
              vecDimension.setElementAt(new Vector(LINKS_IN_DIMENSION), i);
              initializeDimensionVector(dimension + 1, (Vector)vecDimension.elementAt(i));
    }The number of dimensions n is represented by NET_DIMENSIONS.
    The other constant (LINKS_IN_DIMENSION) tells how many different indexes we have per dimension.
    Hope this sample code explains a little bit what I'm trying to do.
    I can close my eyes and forget the warnings, but I come from the C++ world and experience tells that warnings musn't be ignored.
    Regards and thanks for your help.
    Jorge.

  • HOW to ADD F4 help to a  field on SCREEN (MODULE POOL)

    Hi,
         How to add f4 help to a field in screen ..plz help
    Regards,
    Saleha

    Hi Saleha,
                    In order to add F4 help to a field in modeule pool follow these steps:-
    1. First go to SE11 and create your own search help( if you dont know how to create a search help please feel free to ask me, it is very easy).
    2. Now in your module pool program program go to the layout of your screen.
    3. Now when you see the attributes of this field in the Dict tab you will find the field Search Help. Now here you can specify the name of the search help you created in SE11.
    There is also another mehtod to create the dynamic search help. eg:- in a posted document data get the Document nos related to that company code.
    The sample code is like this:-
    First of all declare the module below in the flow logic of your screen then create it in your main program.
    You declare the module in the PROCESS ON VALUE-REQUEST.
    PROCESS ON VALUE-REQUEST.
    FIELD TXT_DOCNO MODULE VALUE_BELNR.
    You also need to create an internal table where you wil store results of the select query fired below in the module.
    here you will get a F4 help on the filed Document Number(TXT_DOCNO) based on the field Company code (TXT_CODCO)
    MODULE VALUE_BELNR INPUT.
    progname = sy-repid.
      dynnum   = sy-dynnr.
      CLEAR: field_value, dynpro_values.
      field_value-fieldname = 'TXT_CODCO'.
      APPEND field_value TO dynpro_values.
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
        EXPORTING
          tabname     = 'BKPF'
          fieldname   = 'BUKRS'
          dynpprog    = progname
          dynpnr      = dynnum
          dynprofield = 'TXT_CODCO'.
    CALL FUNCTION 'DYNP_VALUES_READ'
           EXPORTING
                dyname             = progname
                dynumb             = dynnum
                translate_to_upper = 'X'
           TABLES
                dynpfields         = dynpro_values.
      READ TABLE dynpro_values INDEX 1 INTO field_value.
      SELECT  BUKRS BELNR
        FROM  BKPF
        INTO  CORRESPONDING FIELDS OF TABLE it_doc1
        WHERE BUKRS = field_value-fieldvalue.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield    = 'BELNR'
                dynpprog    = progname
                dynpnr      = dynnum
                dynprofield = 'TXT_BELNR'
                value_org   = 'S'
           TABLES
                value_tab   = it_doc1.
    ENDMODULE.                 " VALUE_BELNR  INPUT
    Hope you find this information useful, let me know.
    Regards,
    Aditya.

  • Add a Help Link to a Discoverer Portlet

    How can I add a Help Link in a Discoverer Portlet?
    Even if I have checked the 'Show Help Link on Portlet Headers' in the Portlet Display Options this does not appear in the Portlet.

    Hi.,
    As far I know it is not possible to create URL link in Area Menu., instead, Create a Report and call Function 'CALL_BROWSER' and pass the url to the function module.
    Now create a Transaction for this report let say ZURL,
    Now Assign this transaction to Area Menu So., When you click that transaction in Area menu it will open Url in browser.
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • Unchecked Call to addElement(E)(resultset with vector)

    Please i am trying to retreive a number of rows with two columns and am trying to add it into a vector object and ots been giving me this error message.
    Unchecked call to addElement(E)
    my code will appear below
    import java.io.*;
    import java.sql.*;
    import com.ecom.util.*;
    import java.util.Vector;
    public class ProdCategory implements Serializable
         Vector catid=new Vector();
         Vector catname=new Vector();
         EcomConnection econ;
         Connection con=null;
         ResultSet rs=null;
         Statement stat = null;
    /*The following method is used to retrieve the values of category Id and category name from CategoryDet table */
         public String getselect()
              try
                   System.out.println("Getting IN");
                   econ = new EcomConnection();
                   con=econ.getConnection();
                   stat=con.createStatement();
                   System.out.println("Connected...");
                   String query="select Ctgry_Id,Ctgry_Name from CategoryDet";
                   System.out.println("Executing Query");
                   rs=stat.executeQuery(query);
                   System.out.println("Executing result set");
                   while(rs.next())
                        catid.addElement(rs.getString(1));
                        catname.addElement(rs.getString(2));
                   System.out.println(" ");
                   rs.close();
                   stat.close();
                   econ.releaseConnection();
                   System.out.println("Connection Closed");
                   return " ";
              catch(SQLException sqlex)
                   System.out.println("There is some problem in SQL Execution..." + sqlex);
                   return "There is some problem in SQL Execution..." + sqlex;
              catch(Exception ex)
                   System.out.println("There is some other problem " + ex);
                   return "There is some other problem ..." + ex;
         /*The following method is used to get the value of catid variable*/
         public Vector getcatid()
              return catid;

    i mearnt to say warning not errors i tried to typecast
    as in: Vector<string> catid=new Vector();
    Vetor<String> catname=new Vector();
    its stop giving me a warning but didnt work at run-time..it was saying nullpointer exception i need assitance

  • How to add f4 help to customized SO

    Hi Experts,
    Could u please help; how to add f4 help to my SO.
    my req.  is ,I have created my SO in my report, i want have f4 help on below filed in my report.
    select-options: s_ihrez for vbak-ihrez.
    Could please help indetails(step by step).
    Thnx.
    POINTS REWARDED immediately.
    Regards. Vishnu.

    hi,
    check the example
    TABLES: mara, makt.
    DATA mat LIKE mara-matnr.
    DATA: BEGIN OF itab OCCURS 0,
    matnr LIKE mara-matnr,
    END OF itab.
    DATA : BEGIN OF btab OCCURS 0,
    maktx LIKE makt-maktx,
    END OF btab.
    DATA : return LIKE ddshretval OCCURS 0 WITH HEADER LINE.
    SELECT-OPTIONS: so_matnr FOR mara-matnr,
    so_maktx FOR makt-maktx.
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_matnr-low.
    PERFORM matnr.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_matnr-high.
    PERFORM matnr.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_maktx-low.
    PERFORM maktx.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_maktx-high.
    PERFORM maktx.
    *& Form matnr
    text
    FORM matnr.
    REFRESH itab.
    SELECT matnr FROM mara INTO TABLE itab.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    retfield = 'MATNR '
    dynprofield = 'P_MATNR '
    dynpprog = sy-repid
    dynpnr = sy-dynnr
    value_org = 'S'
    TABLES
    value_tab = itab
    return_tab = return.
    mat = return-fieldval.
    UNPACK mat TO mat.
    so_matnr = return-fieldval.
    REFRESH return.
    CLEAR return.
    ENDFORM. "matnr
    *& Form maktx
    FORM maktx.
    REFRESH btab.
    SELECT maktx FROM makt INTO TABLE btab WHERE matnr = mat AND spras =
    sy-langu.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    retfield = 'MAKTX'
    dynprofield = 'SO_MAKTX '
    dynpprog = sy-repid
    dynpnr = sy-dynnr
    value_org = 'S'
    TABLES
    value_tab = btab
    return_tab = return.
    so_maktx = return-fieldval.
    REFRESH return.
    CLEAR return.
    ENDFORM. "maktx
    if helpful reward points

  • Warning about unchecked call

    What does it mean?
    warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Vector properties.add(prop);
    and how can I avoid this warning? what shall i check?

    If you use -Xlint, it will tell you the line number.
    Basically, though, you are compiling in j2se 1.5.0, but not specifying the type for the Vector. That is, you are using it in it's pre 1.5.0, raw mode, and it cannot do any compile time type checking for you.
    Say you were using your vector to store Integers. You would declare it as Vector<Integer> myIntegerVector = new Vector<Integer>();and the warning would go away. Now the compiler can do compile time type checking, and let you know when you are using that vector with a type other than Integer, which might not be safe.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to log in with my old Apple account? I forgot my pass and I did change my apple ID before canceling first?? I am from Croatia so did folow al the discussion and the to resolve the problem but no luck. Can not call from Croatia the Apple help desk

    How to log in with my old Apple account? I forgot my pass and I did change my apple ID before canceling first?? I am from Croatia so did folow al the discussion and the to resolve the problem but no luck. Can not call from Croatia the Apple help desk.i did try all the options but I can not find the phone number to call from Croatia,
    I can not change my Apple ID to the old mail (not possible!)
    The old mail don't accept the new password..
    I can not delete the Icloud all the time asking my the password of the old mail!
    I realy need help

    You can not merge accounts.
    Apps are tied to the Apple ID used to download them, you can not transfer them.

  • How to add search help to a field in MARA table

    Hi,
    According to my requirement,I need to add search help to one of the field in MARA.It is checkbox now and it has to be changed to drop down.
    How to do this please help.

    hi u can use HELP-REQUEST option at selection screen or VALUE-REQUEST
    The addition on Value-REQUEST displays the pushbuttuon for F4 help for the corresponding field.
    The value selection is controlled by interactive events.
    pradeep

Maybe you are looking for

  • How can I pass a filter value to another report?

    I'm using a filter within a formula of a field. For example: (FILTER("Facts - Actuals Ledger"."Actual" USING ("Time"."Fiscal Quarter" = '2012 Q 2'))-FILTER("Facts - Actuals Ledger"."Actual" USING ("Time"."Fiscal Quarter" = '2012 Q 1')))*-1 What the a

  • My iphone wont back up to itunes

    Hi - i've been trying to back up my iphone (4) to iTunes for an embarassingly long time, I just really have not had a chance to deal with getting help for it. When I sync, it does not back up even though I choose the option box to do so. With this ne

  • IPad 2 to HDMI - works then looses connection ... any idea why?

    I was able to set up my iPad 2 via HDMI adapter and cable to TV and then change the source to HDMI.  The system found the source and plays a video for about 20 seconds and then loses the connection.  Can't figure it out.  Any help out there? Thanks.

  • Retiming with same number of frames

    Hi (couldn't find this) - If I want to convert my source video to a new frame rate -- but keep exactly the same number of frames -- what is the best way to do that? Do I just set my desired frame rate in the Encoder tab and then set duration to 100%

  • City of origin need to be recorded for PO - and reports required?

    Hi all, My client is requiring city of origin report with respect to PO, can you suggest me through which reports we can get city of origin with respect to PO regards, Sanju