Very odd behavior of 'for' loop with configurable class

Who can explain to me two compile errors in this fragment?
-----
public class JavaBug
{
Public static interface bugs < TBug extends JavaBug >
{
Iterable < TBug > getTBugs();
Iterable < JavaBug > getBugs();
}


public static why (Bugs bugs) Sub
{
for (bug JavaBug: bugs.getTBugs ())
{

}

for (bug JavaBug: bugs.getBugs ())
{

}
}
}

-----

Sorry if an example like that was allredy displayed, just give me a link in this case.

Published by: 816877 November 30, 2010 07:00

If* 1.4 compatibility is your goal. First, you mentioned here. If this isn't a goal, it's the worst answer because you transfer all the insecurity of the run-time type.

Tags: Java

Similar Questions

  • For loops with the cursor line and indexing

    Hi all

    I have a question about the loops with the cursor, line and indexing.

    How can I scan via a cursor with an iterator?

    I would use an iterator as

    Whole LoopIndex;
    Whole LoopIndex2;

    for LoopIndex at the beginning of the cursor at the end of the cursor
    loop
    line =: cursor [LoopIndex];
    for LoopIndex2 of LoopIndex at the end of the cursor
    etc...
    end loop;

    I need to use an iterator because I need to use a nested for loop.



    OR


    How can I solve the following problem?

    Class name % ofClass average test Score
    1 Niobe 7 8 8.4
    1 alena 4 7 7.5
    1 9 7 8.9 Estia
    1 Lilly 10 8 9.8
    1 Sandra 6 8 8.3
    1 Melanie 8 8 8.1
    Nadia 2 8 3 4.4
    Sayuki 2 9 8 8.4
    Diasy 2 7 8 8.0
    Flower 2 7 8 6.5
    Diana 2 6 8 7.3
    3 Flora 7 8 5.8
    Sukiya 3 4 8 8.4
    Samantha 3 10 8 7.7
    Roxanne 3 7 8 6.9
    Eline 3 8 8 7.4

    I need to
    -By class, I need to recalculate each average people
    -By class, I need to calculate the % of class score (sum averages / people in the class)

    So it can be done in a nested for loop?
    Or do I just step by step?

    Well, based on this information it would be something like...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 1 as Class, 'Niobe' as Nm, 7 as Score, 8 as Tests, 8.4 as Average from dual union all
      2             select 1, 'Alena', 4, 7, 7.5 from dual union all
      3             select 1, 'Estia', 9, 7, 8.9 from dual union all
      4             select 1, 'Lilly', 10, 8, 9.8 from dual union all
      5             select 1, 'Sandra', 6, 8, 8.3 from dual union all
      6             select 1, 'Melanie', 8, 8, 8.1 from dual union all
      7             select 2, 'Nadia', 3, 8, 4.4 from dual union all
      8             select 2, 'Sayuki', 9, 8, 8.4 from dual union all
      9             select 2, 'Diasy', 7, 8, 8.0 from dual union all
     10             select 2, 'Blossom', 7, 8, 6.5 from dual union all
     11             select 2, 'Diana', 6, 8, 7.3 from dual union all
     12             select 3, 'Flora', 7, 8, 5.8 from dual union all
     13             select 3, 'Sukiya', 4, 8, 8.4 from dual union all
     14             select 3, 'Samantha', 10, 8, 7.7 from dual union all
     15             select 3, 'Roxanne', 7, 8, 6.9 from dual union all
     16             select 3, 'Eline', 8, 8, 7.4 from dual)
     17  --
     18  -- END OF TEST DATA
     19  --
     20  select class, nm as "NAME", score, tests, average
     21        ,round(((average*tests)+score)/(tests+1),1) as avg_person
     22        ,round((average / sum(average) over (partition by class))*100,1) as class_average
     23  from t
     24* order by class, nm
    SQL> /
    
         CLASS NAME          SCORE      TESTS    AVERAGE AVG_PERSON CLASS_AVERAGE
    ---------- -------- ---------- ---------- ---------- ---------- -------------
             1 Alena             4          7        7.5        7.1          14.7
             1 Estia             9          7        8.9        8.9          17.5
             1 Lilly            10          8        9.8        9.8          19.2
             1 Melanie           8          8        8.1        8.1          15.9
             1 Niobe             7          8        8.4        8.2          16.5
             1 Sandra            6          8        8.3          8          16.3
             2 Blossom           7          8        6.5        6.6          18.8
             2 Diana             6          8        7.3        7.2          21.1
             2 Diasy             7          8          8        7.9          23.1
             2 Nadia             3          8        4.4        4.2          12.7
             2 Sayuki            9          8        8.4        8.5          24.3
             3 Eline             8          8        7.4        7.5          20.4
             3 Flora             7          8        5.8        5.9            16
             3 Roxanne           7          8        6.9        6.9          19.1
             3 Samantha         10          8        7.7          8          21.3
             3 Sukiya            4          8        8.4        7.9          23.2
    
    16 rows selected.
    
  • For loops with the array variable

    I am using a loop for example with the name of the table in the select variable, but get a compilation error

    for current_aud_row in (select * from ' | table_name |' where...)


    table_name contains the name of the actual table

    I do that I get the name of the table as a parameter.
    Help, please!

    Excellent. Oracle APEX (Application Express) is a web IDE and RTS - it makes heavy use of DBMS_SQL to execute SQLs and restore these dynamically in the form of Web-based reports, or turn it into XML for graphical rendering using Flash software.

    DBMS_SQL is perhaps more complex (and only really necessary when it comes true dynamic SQL at all stages - including the result of SQL), but we must know how to use and apply. It is a valuable tool at times.

  • Bug in the conditional for loop with an array empty

    There seems to be a bug in the loop with a conditional terminal.

    If an empty array is connected to an indexed table auto entry tunnel, a tunnel of output array has an element instead of zero.

    The constant matrix is left empty.

    High loop without the conditional Terminal produces an empty array.

    Conditional down with a terminal loop never true generates an array containing a single element

    Thanks to LabVIEW version 8.5


  • 'For' loop with a different number of iterations. Second, the auto-indexation of the tables with different sizes is done. It can affect the performance of the Vi?

    Hello

    I have a loop 'for' which can take different number of iterations according to the number of measures that the user wants to do.

    Inside this loop, I'm auto-indexation four different 1 d arrays. This means that the size of the tables will be different in the different phases of the execution of the program (the size will equal the number of measures).

    My question is: the auto-indexation of the tables with different sizes will affect the performance of the program? I think it slows down my Vi...

    Thank you very much.

    My first thought is that the compiler to the LabVIEW actually removes the Matlab node because the outputs are not used.  Once you son upward, LabVIEW must then call Matlab and wait for it to run.  I know from experience, the call of Matlab to run the script is SLOW.  I also recommend to do the math in native LabVIEW.

  • Odd - Empy Array for loop clears error!

    Hello

    I just wanted to share a little strange behavior, I found - because it took me a while to work on what was going on in a program bug because of that - basically if wire you an empty array for a loop it is not running.  BUT it does not the same in all of the data in this examples of errors (i guesss it don't know what wire goes to what whire) - which could be a problem - it replaces it with the default value.

    I've attached an example for this.

    You will probably find a hundred messages on this forum saying exactly the same thing: it must be one of the less obvious features of LabVIEW.  But yes, if the loop For is not running, the outputs get the default values.  The means of transmitting the error in the loop is to use a shift register - right click on the loop and add - we.  Through the error (or any other value) correctly.  You should always use Shift registers errors!

  • Very strange behavior about variable naming with DataService.fill)

    I feel this behavior strange in LCDS 2.5, which refers to the variable naming for objects returned by a call to DataService.fill (). I was a simple destination with a Java adapter. the Java data object on the server side is defined as)

    test of the package;

    public class RepositoryObject
    {
    private String m_strObjectId;
    Private boolean m_bIsValid;
    private long m_lSize;

    [public poseurs and getters here]
    }

    The side Flex, the ActionScript value object is defined as follows:

    test of the package
    {
    [Bindable]
    [RemoteClass (alias = "test.)] RepositoryObject")]
    public class RepositoryObject
    {

    public var m_strObjectId:String;
    public var m_bIsValid:Boolean;
    public var m_lSize:Number;

    public void RepositoryObject()
    {
    }

    }
    }

    The definition of destination of SDS (in data-management-config. (XML):

    < destination id = "testDs" >

    < Ref adapter = "java-dao" / >

    Properties of <>

    < source > test. TestDS < / source >
    application of < scope > < / scope >

    < metadata >
    < property identity = "m_strObjectId" / >
    < / metadata >

    < network >
    < session-timeout > 20 < / session-timeout >
    < paging enabled = "false" pageSize = "10" / >
    < Butterfly-inbound policy frequency max = "ERROR" = "500" / >
    < political Butterfly-outgoing = 'REPLACE' max-frequency = "500" / >
    < / network >

    < Server >
    < fill method - >
    getObjects < name > < / name >
    < / fill method >
    < / Server >
    < / properties >
    < / destination >

    What I thought was in the debugging client, is the data returned by the service (I use the mx:DataService call) return objects with variable names do not match my definition:

    m_strObjectId becomes objectId
    m_lSize becomes size
    m_bIsValid becomes isValid

    I wonder why the name change? Basically the prefix "m_str" was stripped and capital "O" became tiny 'o' for my first variable, etc.

    For example, in a datagrid CellRenderer I couldn't refer to the returned value as {data .m_strObjectId}, but if I use {data.objectId}, it works.

    Any ideas why this behavior (which I find confusing and odd) would be greately appreciated.
    Robert

    How do you define your getters and setters? For example, for m_strObjectId variable, you have getM_strObjectId like getter or you getObjectId as getter? I suspect the latter.

  • For loops with string

    Excerpt: Labview Developer Suite Sound and Vibration Option 2009 SP1

    I need format some number and strings to insert into a txt file using the loop For. This structure above make the service but an empty space when run the outer loop. I need to remove this empty space, I have tried several ways, but don't get the success.

    Turn the arrow on the figure.

    'Table in spreadsheet string' function apparently puts it in a pair of 'carriage return, new line' all four lines (a "line" of the original array). I could find any arrangement that prevents him, not know not why it presents itself as a space, but if you put a "find and replace" (from the string function palette) and are looking for a 'return Constant transport' and replace with an "empty string", defining the Optional Boolean value "Replace all?" true it removes.

  • cursor for loops with exception handling

    Hi all

    I use oracle11g I need to write a stored procedure to about 10 select statements with the managements of exceptions for each select statement. I am unable to handle the exception handling.please guys help

    Here is the code sample I wrote

    CREATE OR REPLACE PROCEDURE TEST_PROC

    (P_ID IN VARCHAR2,

    P_MOB IN VARCHAR2,

    P_OUT_MSG OUT VARCHAR2)

    AS

    CURSOR CUR_RES AS SELECT NAME, INFO, VER_DETAILS FROM TABLE_NAME WHERE ID = P_ID AND MOBILE_NO IS P_MOB;.

    BEGIN

    FOR REC IN CUR_RES LOOP

    P_OUT_MSG: = 'BKY000. '

    END LOOP;

    EXCEPTION

    WHEN NO_DATA_FOUND THEN

    P_OUT_MSG: = 'BKY001. '

    END;

    OUTPUT DESIREE WHILE RUNNING IN A JAVA APPLICATION IS REQUIRED

    IF THE DATA FOUND BKY000 | RESULT OF THE SELECT STATEMENT

    IF DATA NOT FOUND BKY001

    PLEASE HELP WITH SAMPLE... PLEASE FRIENDS

    It's more clear now

    create or replace procedure test_proc (p_id in varchar2, )

    p_mob in varchar2,

    p_out_msg out varchar2,.

    p_result on sys_refcursor

    ) as

    v_err_msg varchar2 (300);

    row_count number;

    no_data_returned exception;

    nonunique_column exception;

    Start

    Open Select p_result *.

    WCP

    where deptno = to_number (p_id)

    and job = p_mob;

    Select count (*)

    in row_count

    WCP

    where deptno = to_number (p_id)

    and job = p_mob;

         

    If row_count = 0 then

    raise no_data_returned;

    end if;

    Select keep max (count (*)) (dense_rank first order by Count)

    in row_count

    from (select *)

    WCP

    Union all - simulating a duplicate line

    Select 7839, "ETBIN', 'PRESIDENT', null, trunc (sysdate), 3000, null, 10

    of the double

    )

    where deptno = to_number (p_id)

    and job = p_mob

    Group by empno

    view count (*) > 1;

    If row_count > 1 then

    raise nonunique_column;

    end if;

    p_out_msg: = 'BYK0000 ';

                       

    exception

    When no_data_returned

    then p_out_msg: = "BYK001";

    When nonunique_column

    then p_out_msg: = "BYK002";

    while others

    then v_err_msg: = ' procedure TEST_PROC: error: ' | SQLCODE. ': ' || substr (SQLERRM, 1, 200);

    raise_application_error(-20000,v_err_msg);

    end;

    declare

    R_C sys_refcursor;

    E_r emp % rowtype;

    E_m VARCHAR2 (255);

    DEPTNO number: = 10;

    VARCHAR2 (30) employment: = "PRESIDENT";

    Start

    dbms_output.put_line (' input parameters: deptno = ' | to_char (deptno) |) '; job = ' | Job);

    test_proc (to_char (DEPTNO), Job, E_m, R_C);

    dbms_output.put_line (' result: ' | e_m);

    If e_m = "BYK0000" then

    loop

    extract r_c in e_r;

    When the exit r_c % notfound;

    dbms_output.put_line (to_char (E_r.empno) |' |) '|| RPAD(E_r.Ename,10) |' | '|| RPAD(E_r.job,10) |' | '|| TO_CHAR (E_r.SAL, 'fm99990'));

    end loop;

    end if;

    exception

    While other then dbms_output.put_line ('exception: ' | sqlcode |) ': ' || substr (SQLERRM, 1, 200));

    end;

    input parameters: deptno = 10; job = PRESIDENT

    result: BYK002

    Statement processed.

    Concerning

    Etbin

  • for loops with the name of the layer.

    I developed a script that checks if the layer color-101 exists in an open document.

    If the layer color-101 exists executes the block of code on layer color-101.

    If the layer color-101 are not running action Add layer color-101.

    Back at the beginning of the loop to check again

    I do it with a loop for and if statement.

    1. Why does the loop not stop when the loop count variable corresponds to the layer color-101 name variable?

    2. how the loop can return to the beginning to check again the presence of color-101 layer?


    Variable decalre

    app.activeDocument = docRef;

    var theLayer = "color-101;

    loop through the layers

    for (var i = 0; i < docRef.layers.length; i ++) {}

    the layer name corresponds to the loop variable

    If (docRef.layers [i] .name == theLayer) {}

    Execute the block of code for layer color-101

    Alert ("Layer" + theLayer + "exist.");

    }

    }

    layer color-101 was not found, enforcement action Add layer color-101

    Alert ('The' + theLayer + "' there is no layer: Run Add layer color-101 action. '");

    back at the beginning of the loop and check again


    Your loop does not actually stop to find the right layer. He is content to display the alert popup window, then continues. Also the 'not found' - part will still raise. And the comparison must be 100% equal without difference case or spaces or 'copy 12' - suffixes.

    Try something like

    Declaring variables

    app.activeDocument = docRef;

    var layer_found = false;

    loop through the layers

    for (var i = 0; i)< docref.layers.length;="">

    var layer = docRef.layers [i]

    If (Layer.Name.toLowerCase (). IndexOf("case-101") > = 0) {}

    Alert ("found layer:" + layer.name);

    layer_found = true

    do what needs

    }

    }

    If (! layer_found) {}

    Alert ("Layer not found!");

    do what needs

    }

  • APEX 4.1 possible bug or at least a very odd behavior

    Hello

    We have just improved Apex 4.0 to 4.1 and encountered a strange behavior in policy-making.

    I connect to my application, I have a session_id assigned and everything works fine. But for some reason any when I click the developeres toolbar to edit a page, my changes session_id and then when I click the button RUN to display the page that I have


    apex_error_code: APEX. SESSION. DB_SESSION_INIT. UNHANDLED_ERROR


    The best way to solve this problem is to click DEBUG button on the developer toolbar. My old session_id is in the URL and everything works fine.

    Someone knows why this happens.

    Thanks in advance, see you soon.

    Hi Jana,

    a running application must always have a session id different than the builder himself. When you enter the generator and then click RUN, you should get the same id of session app than before. If the session id changes within the current application, this could be caused by the session timeouts or sentry functions or session check returns false. THE APEX. SESSION. DB_SESSION_INIT. UNHANDLED_ERROR is caused by an exception not handled in your application 'initialization Code PL/SQL. However, it should normally show it's more readable "error during database session configuration code processing.

    Could you please add an exception handler that stores the debug output for the "initialization of PL/SQL CODE? If that not discovered the problem, could you please tell us more about this code and your authentication scheme?

    Kind regards
    Christian

  • for loops with movieclips

    Hello:

    I have twenty movieclips on stage with these names:

    G1

    G2

    G3

    G4

    ....

    How to make invisible with a loop for, as

    for (i = 1; i < 20; i ++)

    {

    g + i.Visible = false;

    }

    What does not work.

    Can you help me, please?

    for (var i: int = 1; i< 20;="">

    {

    This ['g' + i] .visible = false;

    }

  • How to move the Cursor parameter for loop with the type of table?

    Hi friends,
    I wonder how to pass a parameter into the second loop in the code example below. Please see the "BOLD" statements and to answer my questions.
    Thank you very much. Here's the code.

    declare
    l_bom_header_tbl BOM_BO_PUB. BOM_HEADER_TBL_TYPE; -TABLE TYPE
    V_bom_header_tbl Bom_Bo_Pub.Bom_Head_Rec_Type: = Bom_Bo_Pub.G_MISS_BOM_HEADER_REC; -Record type
    v_bom_components_tbl Bom_Bo_Pub.Bom_Comps_Tbl_Type: = Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL; - nested table type
    c: number = 0;
    k: = 1 number;
    Start
    BOMPXINQ. () Export_BOM
    P_org_hierarchy_name = > l_org_hierarchy_name,
    P_assembly_item_name = > l_assembly_item_name,
    P_organization_code = > l_organization_code,
    P_alternate_bm_designator = > '1Test. "
    P_Costs = > l_costs,
    P_Cost_type_id = > l_cost_type_id,
    X_bom_header_tbl = > l_bom_header_tbl,
    X_bom_revisions_tbl = > l_bom_revisions_tbl,
    X_bom_components_tbl = > l_bom_components_tbl,
    X_bom_ref_designators_tbl = > l_bom_ref_designators_tbl,
    X_bom_sub_components_tbl = > l_bom_sub_components_tbl,
    X_bom_comp_ops_tbl = > l_bom_comp_ops_tbl,
    X_Err_Msg = > l_Err_Msg,
    X_Error_Code = > l_Error_Code);
    If l_Error_Code = 0 then


    because me in 1... l_bom_header_tbl. COUNTING LOOP
    V_bom_header_tbl.organization_code: = "DSC";

    Can assign us a table type of guy like below the registration statement?
    V_bom_header_tbl.assembly_item_name: is l_bom_header_tbl (i) .assembly_item_name;.

    k: = 1;

    I want to pass the l_bom_header_tbl (i) .assembly_item_name parameter in the declaration below: How do I do this?
    for j from 1... l_bom_components_tbl. COUNTING LOOP

    Can assign us a table type of type array as below the statement?
    v_bom_components_tbl (k). Assembly_Item_name: is l_bom_header_tbl (i) .assembly_item_name;.
    k: = k + 1;
    end LOOP;
    end loop;
    end;

    Published by: ILovePlSql on March 22, 2010 07:51

    Published by: ILovePlSql on March 22, 2010 08:16

    ILovePlSql wrote:
    V_bom_header_tbl emp % rowtype;

    If v_bom_header_tbl has just two fields as ename, sal then also the assignment of type table, record type work or if the record type and the array type have the same structure?

    Yes:

    SQL> declare
      2      type Bom_Head_Rec_Type is record(ename emp.ename%type,sal emp.sal%type);
      3      type BOM_HEADER_TBL_TYPE is table of Bom_Head_Rec_Type index by binary_integer;
      4      l_bom_header_tbl BOM_HEADER_TBL_TYPE;
      5      V_bom_header_tbl emp%rowtype;
      6  begin
      7      select ename,sal bulk collect into l_bom_header_tbl from emp;
      8      for i in 1 .. l_bom_header_tbl.count loop
      9        V_bom_header_tbl.ename := l_bom_header_tbl(i).ename;
     10        V_bom_header_tbl.sal := l_bom_header_tbl(i).sal;
     11      end loop;
     12  end;
     13  /
    
    PL/SQL procedure successfully completed.
    
    SQL>  
    

    SY.

  • How to: display a message while for loops, with no required user input

    Hi everyone, I'm relatively new to LabView, using 8.5.

    I want to display a message all in one for the loop runs, requiring no user input to delete the dialog box (that is to say, the box disappears after the end of the loop For).

    Any ideas?

    Thank you

    Darren


  • for loops with stdout all iterations

    Hello

    I have a loop that calls an external script. The external script something writes to stdout. I would like to see the stdout. I tried to connect a string to standard output, using a tunnel of concatenation. But it always shows only one line to stdout, not all of the output of the iterations. How can I achieve that?

    iviewlab wrote:

    Thanks for your help.

    I want to see stdout running. So I use a shift register for now. But I still don't understand how to get all the exit seeing a single string. I tried to use the building, but it doesn't seem to work?

    How about using concatenate the String?

Maybe you are looking for

  • Best VPN server

    I use the VPN server through Server 5.1. However, I recently bought an EdgeRouter POE, and I plan to change to its VPN. Can someone offer advantages/disadvantages for one against the other? Thank you Jeff

  • A new facility to clean impossible Yosemite (France)

    Hello, here is a summary of my current problem: (4 months of problems) - Etrecheck Software v2.9.11 refuse to run on my Yosemite 10.5.5 -Usual utility of Apple to Report system does not work, unfortunately, I can't tell you the details of my setup. -

  • How to remove the Chief Executive

    How can I remove the administrator that was made when I used my Macbook pro

  • Re: Tecra S11 - sometimes WLAN simply disconnect

    Hello I have a problem with my WiFi. Sometimes my Wlan disconnect the current signal and who says there where no connection available. When I go in my control panel and turn off the Wlan and back on everything works fine again. Sometimes it does is a

  • Annoying problems of 2 blackBerry Smartphones

    I have 2 problems which become right on my nerves. I use a Curve 8310... The first 2 issues are the most important... the third is not so important, but any response is appreciated... Thank you in advance. :-) Problem #1 I want to change the notifica