Method is not defined for type T

I have a class called GernericOrder, which declares a generic type T, and I get an error with this block of code:
     public double totalCost(){
          double sum = 0;
          for(int i = 0; i < pList.size(); i++){
               sum = sum + pList.get(i).price();
          }
          return sum;
     }
This is the error I get:
Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
     The method price() is undefined for the type T
pList is a list of products. I can't change the class of products (according to the rules of the assignment). How can I fix this so that I can sum up the total cost of the products?

pList is a list of products

So it should be declared as a, or more likely the list list and T must be reported as .

Tags: Java

Similar Questions

  • Method is not defined for the type

    What I'm doing wrong here?
    public void testArray(Test2[] tarray){
              for(Test2 t : tarray){
                   System.out.println(t);
              }
    
    //...//
    
    Test2[] passArray = new Test2[4];
    testArray(passArray);  // error: Method testArray(Test2[]) is undefined for type Test.
    Also, for future use, how I format the code for this forum so that it was indented appropriate and easier to read? Thank you.

    Published by: 837443 on February 26, 2011 11:43

    837443 wrote:
    testArray() is a public method. So why should I specify the class that she comes?

    Because it is "static". Static methods belong to the class, not in an instance. And even if it wasn't, you'd still have to provide an instance name.

    Winston

  • WebVPN - error: access method is not supported for the capture of WebVPN

    I'm watching a capture of webvpn on the SAA. I start the capture:

    test type webvpn user capture (entering a valid user name)

    Then I connect to the ASA to try to see track with "Using a browser to capture displayed data" as described in the setup guide.

    https:// / admin/capture/test/OCAP

    After login, I get this message in the browser:

    "Error: access method is not supported for WebVPN capture."

    If I stop the capture (capture test) before you try to connect, the error in the browser is:

    "404 not found".

    The/admin/capture/test/OCAP requested URL was not found on this server. "

    Any ideas greatly appreciated. Thank you!

    After some research, I finally found it

    DOC: Webvpn catches are recorded only in zip format


    CSCtg79320

    Symptom:

    WebVPN captures are only saved in zip format.

    Conditions:

    According to the following doc:

    http://www.Cisco.com/en/us/docs/security/ASA/asa82/configuration/guide/WebVPN.html#wp1153077

    WebVPN captures can be recovered in the pcap format using the browser, which is incorrect. The document must be corrected.

    Workaround solution:

    N/A

    Thank you for your time and cooperation

    Portu.

    In case you have any other questions please note all useful messages and mark this question as answered

  • 1180: call to a method maybe not defined Loader.  ???? WHY?

    Here's my class I'm trying to load a jpg it's show error!

    1046: type was not found or is not a constant of compilation: Loader.

    1180: call to a method maybe not defined Loader.

    package
    {
    import 12345678910111213import
    import flash.net.URLLoader
    import flash.net.URLRequest
    import flash.display.MovieClip

    public class imageloader extends MovieClip
    {
    var imgLd:Loader = new Loader() < it is showing error 
    public void imageloader()
    {
    }
    public void showIMG (img)
    {
    imgLd.load (new URLRequest("Images/"+img))
    addChild (imgLd)
    }
    }
    }

    URLLoader and loader are two different animals... use...

    import flash.display.Loader;

  • The call for a getClipboardContents method maybe not defined through a reference with static type flashx.textLayout.edit:ISelectionManager.

    Hi guys,.

    As I use the Tlf 4.0.0.11073 nigtly version.

    I want to copy some text from the TLF, by the copy operation. I get this error.

    -Call to a method may not set getClipboardContents via a reference type static flashx.textLayout.edit:ISelectionManager.

    In the previous generation, I do not get this type of error, but in this nocturnal compilations, I get this error.

    Can someone help me to fix the same or all workaound.

    Thanks in advance.

    Krishna

    This feature is always available, but it has been moved. He is now in a class of TextClipboard, in the same package flashx.textLayout.edit. If you need to replace calls to getClipboardFormat() by TextClipboard.getContents ().

    Hope this helps,

    -robin

  • Get the error not defined for the current document in the script

    I get a "error number: 2" "error string: myDoc is not defined" in my script.

    I modified a few scripts so that they cross my entire book and open each section (document) in my book, and run the code for each section.ext

    The code runs great and opens and closes the sections where it does not add links to text, but once, it opens a document and view text that you CAN add links, it generates this error.  Here is my code:

    main();
    exit();
    
    function main() {
        var myBook = app.activeBook,
                myDocs = myBook.bookContents.everyItem().getElements(),
                myDoc,
                myHyperlinkStyle,
                myCount = 0;
    
        for (var i=0; i< myDocs.length; i++) {
            myDoc = app.open(File("\\\\computerOnNetwork\\c$\\Folder\\" + myDocs[i].name));
            myHyperlinkStyle = myDoc.characterStyles.item("linkstyle");
    
            try {
                var script = app.activeScript;
            } catch(err) {
                var script = File(err.fileName);
            }
            var myScriptFolderPath = script.path;
            var myFindChangeFile = new File(myScriptFolderPath + "/SearchTextAndUrls.txt"); //mac path for users desktop //File.openDialog("Choose the file containing the tab separated list"); 
            //alert(myFindChangeFile)
            myFindChangeFile = File(myFindChangeFile);
            var myResult = myFindChangeFile.open("r", undefined, undefined);
            if(myResult == true){
                app.findTextPreferences = NothingEnum.nothing;
                app.changeTextPreferences = NothingEnum.nothing;
                //Loop through the find/change operations.
                do {
                    //read 1 line into myLine
                    myLine = myFindChangeFile.readln();
                    myFindChangeArray = myLine.split("\t");
    
                    //The first field in the line is the value to find 
                    myFindVal = myFindChangeArray[0];
    
                    // second is the url
                    myFindUrl = myFindChangeArray[1];
    
                    doSearchAndReplace(myFindVal, myFindUrl, app.activeDocument);
    
                } while(myFindChangeFile.eof == false);
                    myFindChangeFile.close();
                    // reset search
                    app.findTextPreferences = NothingEnum.nothing;
                    app.changeTextPreferences = NothingEnum.nothing;
            }
            alert("Done! " + myCount + " hyperlinks have been added.");
    
            myDoc.close();
        }
    }
    
    function doSearchAndReplace(stringfind, urlstring, searchin) {
        app.findTextPreferences.findWhat = stringfind;
    
        //Set the find options.
        app.findChangeTextOptions.caseSensitive = false;
        app.findChangeTextOptions.includeFootnotes = false;
        app.findChangeTextOptions.includeHiddenLayers = false;
        app.findChangeTextOptions.includeLockedLayersForFind = false;
        app.findChangeTextOptions.includeLockedStoriesForFind = false;
        app.findChangeTextOptions.includeMasterPages = false;
        app.findChangeTextOptions.wholeWord = false;
    
        var myFoundItems = searchin.findText();
    
        for (i = 0; i < myFoundItems.length; i++) {
            var myHyperlinkDestination = myMakeURLHyperlinkDestination(urlstring);
            myMakeHyperlink(myFoundItems[i], myHyperlinkDestination);
            myFoundItems[i].applyCharacterStyle(myHyperlinkStyle, false);
            myCount++
        }
    }
    
    function myMakeHyperlink(myFoundItem, myHyperlinkDestination){
        try {
            var myHyperlinkTextSource = myDoc.hyperlinkTextSources.add(myFoundItem);
            var myHyperlink = myDoc.hyperlinks.add(myHyperlinkTextSource, myHyperlinkDestination);
            myHyperlink.visible = false;
        }
        catch(myError){
        }
    }
    
    function myMakeURLHyperlinkDestination(myURL){
        //If the hyperlink destination already exists, use it;
        //if it doesn't, then create it.
        try{
            var myHyperlinkDestination = myDoc.hyperlinkURLDestinations.item(myURL);
            myHyperlinkDestination.name;
        }
        catch(myError){
            myHyperlinkDestination = myDoc.hyperlinkURLDestinations.add(myURL);
        }
        myHyperlinkDestination.name = myURL;
    
        //Set other hyperlink properties here, if necessary.
        return myHyperlinkDestination;
    }
    

    Any help is greatly appreciated!

    That ends up being my fixed/final code:

    main();
    exit();
    
    function main() {
        var myBook = app.activeBook,
                myDocs = myBook.bookContents.everyItem().getElements(),
                myDoc,
                myHyperlinkStyle;
    
        for (var i=0; i< myDocs.length; i++) {
            myDoc = app.open(File("\\\\computerOnNetwork\\c$\\Folder\\" + myDocs[i].name));
            myHyperlinkStyle = myDoc.characterStyles.item("linkstyle");
    
            try {
                var script = app.activeScript;
            } catch(err) {
                var script = File(err.fileName);
            }
            var myScriptFolderPath = script.path;
            var myFindChangeFile = new File(myScriptFolderPath + "/SearchTextAndUrls.txt"); //mac path for users desktop //File.openDialog("Choose the file containing the tab separated list");
            //alert(myFindChangeFile)
            myFindChangeFile = File(myFindChangeFile);
            var myResult = myFindChangeFile.open("r", undefined, undefined);
            if(myResult == true){
                app.findTextPreferences = NothingEnum.nothing;
                app.changeTextPreferences = NothingEnum.nothing;
                //Loop through the find/change operations.
                do {
                    //read 1 line into myLine
                    myLine = myFindChangeFile.readln();
                    myFindChangeArray = myLine.split("\t");
    
                    //The first field in the line is the value to find
                    myFindVal = myFindChangeArray[0];
    
                    // second is the url
                    myFindUrl = myFindChangeArray[1];
    
                    doSearchAndReplace(myFindVal, myFindUrl, app.activeDocument, myDoc, myHyperlinkStyle);
    
                } while(myFindChangeFile.eof == false);
                    myFindChangeFile.close();
                    // reset search
                    app.findTextPreferences = NothingEnum.nothing;
                    app.changeTextPreferences = NothingEnum.nothing;
            }
            alert("Done! Hyperlinks have been added.");
    
            myDoc.close();
        }
    }
    
    function doSearchAndReplace(stringfind, urlstring, searchin, myDoc, myHyperlinkStyle) {
        app.findTextPreferences.findWhat = stringfind;
    
        //Set the find options.
        app.findChangeTextOptions.caseSensitive = false;
        app.findChangeTextOptions.includeFootnotes = false;
        app.findChangeTextOptions.includeHiddenLayers = false;
        app.findChangeTextOptions.includeLockedLayersForFind = false;
        app.findChangeTextOptions.includeLockedStoriesForFind = false;
        app.findChangeTextOptions.includeMasterPages = false;
        app.findChangeTextOptions.wholeWord = false;
    
        var myFoundItems = searchin.findText();
    
        for (i = 0; i < myFoundItems.length; i++) {
            var myHyperlinkDestination = myMakeURLHyperlinkDestination(urlstring, myDoc);
            myMakeHyperlink(myFoundItems[i], myHyperlinkDestination, myDoc);
            myFoundItems[i].applyCharacterStyle(myHyperlinkStyle, false);
        }
    }
    
    function myMakeHyperlink(myFoundItem, myHyperlinkDestination, myDoc){
        try {
            var myHyperlinkTextSource = myDoc.hyperlinkTextSources.add(myFoundItem);
            var myHyperlink = myDoc.hyperlinks.add(myHyperlinkTextSource, myHyperlinkDestination);
            myHyperlink.visible = false;
        }
        catch(myError){
        }
    }
    
    function myMakeURLHyperlinkDestination(myURL, myDoc){
        //If the hyperlink destination already exists, use it;
        //if it doesn't, then create it.
        try{
            var myHyperlinkDestination = myDoc.hyperlinkURLDestinations.item(myURL);
            myHyperlinkDestination.name;
        }
        catch(myError){
            myHyperlinkDestination = myDoc.hyperlinkURLDestinations.add(myURL);
        }
        myHyperlinkDestination.name = myURL;
    
        //Set other hyperlink properties here, if necessary.
        return myHyperlinkDestination;
    }
    
  • 'LOB not supported for type' error occurs when executing DBMS_LOB. FRAGMENT_INSERT

    Hi all
    I'm trying to launch DBMS_LOB. FRAGMENT_INSERT, but got error saying:
    ORA-43856: Unsupported LOB type for SECUREFILE LOB operation
    Suppose I have the following code:
    declare
    note_clob clob;
    note_clob2 clob;
    note_bfile bfile;
    buffer varchar2(10000);
    note_var varchar2(10000);
    warning int;
    dest_off int:=1;
    src_off int:=1;
    lang_ctx int:=0;
    amount int:=1500;
    
    begin
    --Create temp
    dbms_lob.createtemporary(note_clob,true);
    
    --Initialize BFILE
    note_bfile:=bfilename('TEMP_DIR','note.txt');
    --Open bfile
    dbms_lob.fileopen(note_bfile);
    
    dbms_lob.loadclobfromfile(note_clob,note_bfile,dbms_lob.lobmaxsize,dest_off,src_off,0,lang_ctx,warning);
    
    dbms_lob.fileclose(note_bfile);
    
    --Fragement Insert
    amount:=3;
    dest_off:=10;
    buffer:='end';
    dbms_lob.fragment_insert(note_clob,amount,dest_off,buffer); <==LINE 30
    
    --Read
    amount:=50;
    dbms_lob.read(note_clob,amount,1,note_var);
    
    dbms_output.put_line(note_var);
    end;
    /
    and I got:
    ERROR at line 1:
    ORA-43856: Unsupported LOB type for SECUREFILE LOB operation
    ORA-06512: at "SYS.DBMS_LOB", line 1076
    ORA-06512: at line 30
    What did I miss?

    Better subject.
    TA.

    only recently switched to 11g and 10g DBMS_LOB have FRAGMENT stuff

    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28278/e43750.htm suggests

    ORA-43856: not taken object Type supported for operation SECUREFILE LOB
    Question: A SECUREFILE Lob operation was published on an unsupported object type.

    Action: Don't use this function for BASICFILE LOBs.

    Seems DBMS_LOB. FRAGMENT procedures work with LOB secure files only. :(

    Concerning

    Etbin

  • Error - &amp; &amp; operator is not defined for the java, type arugument lagn.string

    Hi all

    I am new to this forum and also java.
    Here is my program
    Please let me know the fix for this error

    Thank you
    Guna

    The logic is, I want to check the customer first, last and middle name.

    Senario 1: I want to check the name of the customer, if he gives only the NAME
    Senario 2: I want to check the name of the customer, if he gives the last NAME only
    Senario 3: I want to check the name of the customer, if he gives only the NAME
    Senario 4: I want to check the name of the customer, if he gives the first name and last name - this wher I get my error






    My coding

    self-learning package;
    Import Java.util;
    public class CustomerUtil {}

    Boolean SearchCustomer (List < Customer > listObj, customer cust)
    {

    Iterator listOfCustomerObj = listObj.iterator ();
    Customer cust1 = null;
    While (listOfCustomerObj.hasNext ())
    {
    cust1 = listOfCustomerObj.next ((customer));
    }

    If (cust1.getFirstName (.equalsIgnoreCase (cust.getFirstName ())))
    {
    System.out.println ("found customer");

    }
    If (cust1.getLastName (.equalsIgnoreCase (cust.getLastName ())))
    {
    System.out.println ("found customer");

    }

    I get the error message here, how to fix this error. Please let me know is there any other want to rewrite this condition.

    If (cust1.getFirstName () & & cust1.getLastName () .equalsIgnoreCase (cust.getFirstName () & & cust.getLastName ()))
    {

    System.out.println ("found customer");
    }

    Returns true;
    }


    }

    Matt wrote:
    People
    I'm new to this forum and also in java.

    I'll post any coding.
    I tried to put the code tag but his does not work. Sorry
    I saw the link, but I can't do it.

    Here is my code

    private static final int FIRST_NAME_MATCH = 1,
                             LAST_NAME_MATCH = 10,
                             WHOLE_NAME_MATCH = 11;
    int SearchCustomer( List listObj , Customer cust ) {
      Iterator listOfCustomerObj = listObj.iterator();
      Customer cust1 = null;
      int matchCount = 0;
      while(listOfCustomerObj.hasNext()) {
        matchCount = 0;
        cust1 = listOfCustomerObj.next();
        if ( cust1.getFirstName().equalsIgnoreCase( cust.getFirstName() ) )
          matchCount += FIRST_NAME_MATCH;
        if ( cust1.getLastName().equalsIgnoreCase(cust.getLastName() ) )
          matchCount += LAST_NAME_MATCH;
        if (matchCount == WHOLE_NAME_MATCH) break;
      }
      return matchCount;
    }
    

    The light of the foregoing, it is my best guess at what you describe you want. But it is not really make sense unless you think that you want the first person who is on the first and last names; what you could do to help eliminate the duplicates. But if this is the case you should consider a set instead of a list as they are not duplicates is added in the first place.

    Maybe you can take some ideas from this property. But if you want to match each person with the immediately previous person, then you must edit the item of the loop by removing of this method and put it in the method that calls this method, passing the two customers only and comparing them, or something like that.

  • 1061:call to an addEventListener method maybe not defined through a reference with static type class

    I used code snippets to move keyframe 1 to 2 with this code there is a button.




    / * Stop to this image

    The Flash timeline will be stop/pause on the frame where you insert this code.

    Can also be used to stop/pause the chronology of the movieclips.

    */

    Stop();

    / * Click to supervise and stop

    By clicking on the instance for the specified symbol moves the playback cursor to the frame specified in the timeline panel and stop the movie.

    Can be used in the main timeline, or on timelines of film clip.

    Directions for use:

    1. replace the number 5 in the code below with the image number you want the playback head to when the user clicks the symbol instance.

    */

    Playbtn.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_6);

    function fl_ClickToGoToAndStopAtFrame_6(event:MouseEvent):void

    {


    gotoAndStop (2);

    }

    but I get this error, can anyone help?

    the error I get if I change the name in the code name of the class instead

    Undefined property 1120:access Playbutton

    (the name of the instance is Playbtn)

    Thanks for your concern!

    As I said, this isn't a rare mistake to start to mix up to appoint between "btn" and "button"... you have already demonstrated do between your first two job offers.  If "Playbutton" is the name of the class, then impossible to assign an event listener to it as you just demonstrated in response 3

  • 1061: call to a shuffleKnuth method maybe not defined through a reference with static type class.

    Hi, I get the above error. I have actually changed some code because I put it in its own class.

    I call the class ShuffleArray below in my main doc of the class as follows:

    ShuffleArray.shuffleKnuth (definitionsArray);

    package
    {
    public class ShuffleArray
    {
    public void ShuffleArray()
    {
    the constructor code
    }
    public void shuffleKnuth(originalArray:Array):void
    {
    var chosenElement: *;
    var randomElement: *;
    var r: int = 0;

    for (var i: int = originalArray.length - 1; i > 0; i-)
    {
    r = Math.Random () * i;
    chosenElement = originalArray [i];
    randomElement = originalArray [r];

    originalArray [i] = randomElement;
    [r] originalArray = chosenElement;
    }
    }
    }
    }

    A little your docClass should like this:

    package {}
       
    import flash.display.MovieClip;
    Import ShuffleArray;
       
    public class docClass extends MovieClip {}
    private var shuffArr:Array = new Array (10,20).
           
    public void docClass() {}
    the constructor code
    ShuffleArray.shuffleKnuth (shuffArr);
    }
    }
       
    }

    and function ShuffleArray in the other class must be declared with static.

    public static void shuffleKnuth(originalArray:Array):void
    {
    trace (originalArray);
    }

  • Why the setFocus() and setText() methods does not work for BasicEditField

    Hello

    I tried to apply the methods of setFocus() and setText() on a BasicEditField, but he always up "illegal state exception.   However, the getText() method can work.

    Can someone explain this please? Thank you!

    Another thing would be - if you use filters on your EditField and allows you to define something that is not allowed by the filter, it will throw an exception setText()...

  • ReferenceError: vm is not defined for the wait for the DNS name?

    Has anyone seen this message before? I just started to receive when I try to build our vCenter our Dallas vCAC California machines. This happens during the commissioning and is taken on an Action of "vim3WaitToolsStarted". Is - it may expire due to the latency? He manages to pass the stage of construction and the name is defined very well.

    Edit: I can build local machines very well. It is only during the construction of machines in California I get this error.

    Edit2: I notice that VC:VirtualMachine wants to say "Undefined" while others such as the vCAC:VirtualMachine show the name of the virtual machine. The action of the vim3Waittoolsstarted requires VC:VirtualMachine. I have no idea why vCAC would not pass this info to a set of machines over another?

    While you wait, I recommend this change (this is the new default and VMware has recommended to several people in the 6-9 months): check /etc/vco/app-server/vmo.properties (or find the file if don't use only not the vCO device) and add the following line (if not present): com.vmware.o11n.vim.useInventoryService = false

    Then you can re - try and see if it works... The inventory service is bad juju with some calls in more recent versions of the vSphere plugin, and that will be the value default value moving forward (I think starting with 5.5.2? Don't remember).

    That could put you straight.

    -Steve

  • $v is not defined

    Hello

    Apex 4.2, I always used $v to get the value of any page.

    For example: var myName = $v ('P1_X_NAME');

    Recently, I've migrated my app in Apex 5 universal theme and now when I get error $v is not defined for all of the code that works very well in 4.2 Apex.

    I tried

    var MyName = $v ('P1_X_NAME');

    var MyName = $v ("P1_X_NAME");

    var MyName = $x ('P1_X_NAME');

    var MyName = $x ("P1_X_NAME");

    No the above worked. Can you please.

    Kind regards

    Animesh

    Hello

    You must migrate it for example dynamic action.

    Kind regards
    Jari

  • Address deposit not set for a virtual appliance (CIQ), it does not support updates by CR

    I have a CapacityIQ evaluation courses. I need revoot our vCenter server this weekend and I got some errors.

    (1) repository address not defined for the virtual appliance for upgrades of WILL.

    Someone at - it understand why I see this error. Also, I'm not sure why VUM even tries to analyze the VA?

    Why you see the error: you see the error it's because our WILL is not configured to make the VUM updates and does not point to a repository VUM.

    Why VUM attempts to analyze this GOES: because it assumes that all going to will be set to VUM updated. As far as I KNOW, they will improve on this message error/logic in the near future. During this time you will see this error if you installed VUM.

  • Call to a method may not be defined for Custom Itemrenderer Component

    Hi all

    < mx:Application >

    < mx:Script >
    <! [CDATA]

    public quiet function (): void
    {

    }

    []] >
    < / mx:Script >

    < XY = "0" mx:Panel = "0" width = "530" height = "405" layout = "absolute".
    title = "Item Renderers" >
    < XY = "0" mx:DataGrid = "0" width = "510" height = "365" >
    < mx:columns >

    < mx:DataGridColumn headerText = "Song" width = "50" >
    < mx:itemRenderer >
    < mx:Component >
    < mx:VBox verticalGap = "10" >
    < mx:Label text = "Happy" / >
    < mx:Button label = "Edit" click = "quiet ()" / >
    < / mx:VBox >
    < / mx:Component >
    < / mx:itemRenderer >
    < / mx:DataGridColumn >

    < / mx:columns >
    < mx:dataProvider >

    < / mx:dataProvider >
    < / mx:DataGrid >
    < / mx:Panel >
    < / mx:Application >

    why, I make this appeal to a quiet method maybe not set, how do I solve this problem?

    use outerDocument.callme

Maybe you are looking for

  • 10 IOS messing around with my apps

    When I updated my phone to IOS 10 it temporarily removed some applications to free up space and said that it would re-install them shortly after. I have at least 5 GB of memory and only 3 applications are removed. Now my apps are blackened out and do

  • The tabs and the appearance of the firefox browser glitch

    The upper part of the firefox or bars appear with glitches akward. I think the screenshots to explain better. Hope the community finds a solution. Thank you for your attention.

  • Hard drive is dead/lost Pages

    I replaced my drive hard when disk utility told me that the original, we weren't. Everything was backed up via Time Machine and more seems to have recharged properly. However, I bought Pages and Keynote Apps. but they were not included when I reloade

  • activeX DIADEM

    OR Diadem 10.2 I like poter utilizzare i there ACTIVEX in DIADEM. Ho trovato nel forum one ' esempio di use del Toolbar Microsoft activeX. Tried insert it controllo MSComctlLib.Toolbar.2 ButtonFile creato UN UN BottonMenu E '''''''''' Void MSComctlLi

  • HP pavilion p6 - in 2356: white screen on the modernization of new NVIDIA graphics card

    I have a hp pc model no p6 product - 2356 in no #ACJ H3W39AA with windows 8.1 update installed on the computer. There already is an entry level graphics card NVIDIA geforce 620 installed in the computer as part of the specifications. However, I wante