Behaviour of the Stack-Iterator

I've just wondered about the strange behavior of my program and found the reason in the "unintuitive" implementation of the iterator an stack returns. I would expect the iterator to begin from the "end" of the stack, and not at the beginning.
Therefore my stack for-loop ( for(String s: someStack) ) is behaving like a vector-loop. Is this the way its supposed to be?
Edited by: SaschaZorn on Nov 7, 2007 5:26 PM

Apparently so, as the iterator methods are inherited. I agree that it's counter-intuitive but it's not going to change now ...

Similar Messages

  • Strange behaviour of the rangeSize - or is it desired?

    Hi there,
    as recently asked in Difference between VO Fetch Size, Iterator rangeSize and af:table Fetch Siz we have a problem with the rangeSize property of the iterator binding.
    First of all, we're currently working wit JDev version 11.1.2.2.0. So, we have a page with a table. In this table is nested inside a panel collection which is nested inside a panel stretch layout. To cut a long story short, it stretches.
    The rangeSize is now set to the default 25, but you could see in the fullscreen usage about 35 rows. When we now select a row which is in the rage of the first 25 records and use the data in such a method:
    RichTable table = this.getTable();
    RowKeySet rowKeySet = table.getSelectedRowKeys();
    Iterator selectetNodesIterator = rowKeySet.iterator();
    CollectionModel treeModel = (CollectionModel)table.getValue();
    JUCtrlHierBinding treeBinding = (JUCtrlHierBinding)treeModel.getWrappedData();
    while (selectetNodesIterator.hasNext()) {
      List selectedRowKeyPath = (List)selectetNodesIterator.next();
      JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(selectedRowKeyPath);
      Row row = nodeBinding.getRow();
      DBSequence aaId = (DBSequence)row.getAttribute("AaId");
    }We got a NPE at Row row = nodeBinding.getRow();, because the nodeBinding is null. Only the last fetched records have a JUCtrlHierNodeBinding.
    So yeah ok, for testing purposes we changed the rangeSize to 1, just to see what happens. And again it fetches one row after another as long is the tables current view is full. And if we try it again every record results in a NPE excpet the very last visible record. So far so good, after what we've seen with 25 records this was expected.
    When we change the rangeSize to a value greater than 36 (the visible rows, in that current fullscreen resolution) it works as it should.
    So, to see if there is a bug i decided to create a small testapp with the HR schema. I've just dropped the employees vo as a table inside a panel collection which is nested inside a panle stretch layout. And used nearly the same method:
    public String onButtonClicked() {
      RowKeySet rks = table.getSelectedRowKeys();
      CollectionModel tablemodel = (CollectionModel)table.getValue();
      JUCtrlHierBinding binding = (JUCtrlHierBinding)tablemodel.getWrappedData();
      Iterator it = rks.iterator();
      while(it.hasNext()){
        List selectedRowKeyPath = (List)it.next();
        JUCtrlHierNodeBinding node = binding.findNodeByKeyPath(selectedRowKeyPath);
        Row row = node.getRow();
        System.out.println("Testausgabe: " + row.getAttribute(1));
      return null;
    }When the rangeSize is now set to 1 every visible row except the last also result in a NPE. If we run that above code on a button click, but now the strange part. When the rangeSize is changed to a value greater 1 it works like a charm. You can run that code with every visible record an you get now NPE. Also very strange with a rangeSize = 1, when you select the last visible record which is working and run the code, then select a record above, which had thrown an NPE previously and run the code. It is working, but with the value of the last visible record.
    This leads us to a bunch of questions.
    1) Is it the supposed way to work, that you get a NPE when the rangeSize is set to a smaller number than visible rows?
    2) If 1) is the desired way, how do you handle the rangeSize for a table which is stretched? You couldn't now how many rows you could see.
    3) Does anyone have an idea how to explain the last explained behaviour with the testapp? (I could upload it)
    Thanks in advance.
    Alex

    Hi Alex,
    can you open a SR at Oracle support for this issue?
    I know there are several bugs which are somehow related with the rangeSize and the synchronization of the model (currrent row) and the view (in this case the visible part of af:table).
    See also Restore current row after rollback does not work with page ranging
    As far I know Oracle plans some enhancements in this area to fix the syncronize problems and change e.g. the rangeSize dynamically depending on the number of rows visible in the GUI.
    But anyway your issue sounds like a new bug.
    regards
    Peter

  • How can I sync ONLY the top photo in the stack?

    I sync various Aperture photo albums to my IPad and iPhone. The problem is that when I have 'stacked' images (eg. one image showing in the album and two other copies 'hidden' underneath), all of the photos in the stack are copied to the ipad and iPhone. So instead of seeing just one version of an image, I see as many as are in the stack. How can I sync ONLY the top photo in the stack?
    Thanks for your help!

    I solved my own problem.
    The sync problem seemed to only occur on smart albums. There is a new check box option in Aperture 3 when making a smart album: "sync stack pick only." One click and the problem is solved!

  • Cannot increase the stack size

    Hi,
    We have a program which gives a StackOverflowError. Trying the increase the stack size using command line options does not work. A simple program shows that the stack is the same size, whatever option we set.
    This is the program:
    class StackOverflowTest
    public static int counter = 0;
    public static void main(String[] a)
    try {
    sub();
    } catch (StackOverflowError e)
    System.out.println("recursive calls: "+counter);
    public static void sub()
    counter++;
    sub();
    We tried several -Xss (and -Xoss) settings: 600K, 2048K, 4M but got the same recursion deep: 16683 (with Eclipse), or 16689 (command line).
    We used Windows XP.
    Do you have any clue?
    Many thanks,
    Zsolt

    Oh good, they seem to have broken the forum formatting again.
    ====================================================================================================================
    Bug ID:     4362291     Stack size argument ignored (-Xss and -ss)
    ====================================================================================================================
    public class StackOverflowTest {
        public static int counter = 0;
        public static final void main(String[] a) {
            new Thread(new Runnable() {
                public void run() {
                    try {
                        sub();
                    } catch (StackOverflowError e) {
                        System.out.println("recursive calls: "+counter);
            }).start();
        public static final void sub() {
         counter++;
         sub();
    /code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Is there a flowchart describing gc behaviour of the Sun hotspot jvm?

    Given that garbage collector tuning is such an important part of application deployment it is surprising that the behaviour of the garbage collector implemented in the Sun JVM is so poorly documented.
    Our system is displaying behaviour changes that we don't expect and do not want and it we can't find enough information to predict how the garbage collector will behave under expected and changing conditions. This makes it impossible to select sensible parameters for our system.
    For example, we have included the -Xincgc option when running a weblogic6.0 server to reduce the size of the gc pauses. Monitoring the memory (both on the weblogic console and via -verbose:gc) we have small gcs happening quite frequently but after a couple of hours it switches over to full gcs and stays that way for ever after. The full gcs bring on the longer delays for garbage collection (typically around 5 seconds) every 5 minutes or so.
    Incidentally, we assume the small gcs are the incremental gcs performed on the old area but there is no way to distinguish those from the little scavenging gcs that are performed even without -Xincgc.
    The total memory used is quite modest (1/4 to 1/2 the size generally) compared to the max heap size and the old area and comparable to the new area.
    If there is a flowchart or uml activity diagram that describes the hotspot gc behaviour so that we could be a little more deterministic in our approach to gc tuning I would be most grateful to get access to it. This trial and error approach is very frustrating.
    There's some very useful information out there about the structure of the java heap and the meaning of the various options and even the garbage collection algorithms themselves but it is not sufficient to specify the behaviour of the specific hotspot jvm from Sun Microsystems.
    I liken it to having a class diagram describing a highly dynamic system but no interaction diagrams.

    I would also love to have a comprehensive explanation of garbage collection in Java. I'm still mystified by it in some respects.
    The author of this thread has obviously researched Java GC... don't know if this helps, but someone in another thread posted this link to a JDC Tech Tips issue concerning memory allocation and GC:
    http://developer.java.sun.com/developer/TechTips/2000/tt1222.html
    Also the links near the bottom may be worth checking out...
    There's something in that web page that I still don't understand and I think I will post a message about it soon.

  • Default behaviour of the Escape key while editing a cell in JTable??

    Hi all,
    i have a Jtable which get its data from an own model object which extends DefaultTableModel.
    If i overwrite the isCellEditable(row, col) method within the tablemodel object and set a specific column to editable, then i notice while editing a cell in that column that the default behaviour of the Escape key is that independet from what you have entered before in to the cell the editing stops and the cell gets the value it had before editing.
    This is the case for me even if i apply a custom editor to a column (one that extends DefaultCellEditor). It is just a JTextField that limits the number of digits a user can enter. Everything works fine. If the user edits the cell and presses ENTER or the "down arrow key" i can check what he has entered with the help of the getCellEditorValue() method. But if the user hits the ESC key after editing a cell this method is not invoked!!!
    My question is :
    is there any way to detect that the user cancels editing with the ESC-key.
    this is very important for me because if the user goes editing the cell i lock the related record in the database, if i cannot detect this it is locked till the application terminates.
    Thanks for any help in advance

    I try override the JTable editingCanceled() ==> does not work.
    I try the addCellEditorListener( CellEditorListener l ) ==> does not work.
    Finally, I try the addKeyListener ==> it works.
    Here is a quick demo. program:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    public class Test {
    public static void main(String[] args){
    JFrame f = new JFrame();
    String[] colName = {"a", "b"};
    String[][] rowData = {{"1", "2"}, {"3", "4"}};
    JTable table = new JTable(rowData, colName);
    JTextField t = new JTextField(10);
    t.setBackground(Color.red);
    t.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
    // do what ever you want ex. un-lock table
    System.out.println("ESCAPE");
    DefaultCellEditor editor = new DefaultCellEditor(t);
    TableColumnModel colModel = table.getColumnModel();
    for (int i = colModel.getColumnCount()-1; i >= 0; i--) {
    colModel.getColumn(i).setCellEditor(editor);
    f.setContentPane(new JScrollPane(table));
    f.pack();
    f.setVisible(true);

  • Error while downloading the stack file

    Hi,
    I'm in the process of upgrading my EhP4 system to EhP5.
    While trying to generate the file via MOPZ, I just can't seem to "Continue" with the Enhancement package installation option.
    The error's as follows:
    "Successor installed for SAP SNC 2007."--Check SMSY. (SMSY is perfectly reflecting whatever's installed on the ECC system.)
    I just can't figure out where SNC has cm in from.
    I do have the component ECC-SE on 604...does this have anything to do with it?
    Pls. help..
    Thank You,
    Saba.

    Hi Saba,
    I've had the same problem as you building the stack file for an EHP5 upgrade and have CPRXRPM version 400 installed. I used you idea of adding SAP SNC 7.0 as an installed product under the ERP system which enabled be to continue the mopz config and build a stack file.
    Now when attempting the upgrade I get :-
    "The Installation/Upgrade Package for Add-on SCMSNC rel. 700 is not available"
    This is not that surprising I guess as its not installed.
    Did you also come across this, if so were you able to bypass this?
    Thanks
    Warren

  • In LR6CC, after using the merge to HDR and the photo returns to LR as a DRG, it is not automatically put into a previously set up stack. For example a stack of three photos. If I use NIK HDR and the photo returns to LR, the stack is automatically changed

    In LR6CC, after using the merge to HDR and the photo returns to LR as a DRG, it is not automatically put into a previously set up stack. For example a stack of three photos. If I use NIK HDR and the photo returns to LR, the stack is automatically changed from 3 to 4. When LR's HDR merge brings a photo back into LR's library, the stack number does not change and the DRG version isn't included in the stack.

    Hi,
    The Ps CS6 public beta version contains the same camera support as found in Ps CS5/5.5 compatible CR 6.6. There will be future updates to CR 7 for Ps CS6 to pick up more camera support. The Nikon D800 NEF files are not supported, yet.
    If you like to work with your D800 files in the public beta build now, you'll have to get the DNG Converter 6.7 from here: http://labs.adobe.com/technologies/cameraraw6-7/
    and convert your files to DNG.
    regards,
    steve

  • Web DynPro Behaviour when the Reload button is pressed

    Hi,
    I'd like to know what is the behaviour of the Web DynPro when an user presses the Reload button on the browser.
    I'm asking this because I designed a WDP that has a view with some input fields, two button and a table to show the result of a search operation based on the content of the input fields.
    Some of the input fields are text inputs and others are dropdown list controls. In some cases, e.g. after having performed a search, if I hit the Reload button the content of one dropdown list was shown in another dropdown list.
    The dropdown lists and the other input fields are bound to some context attributes and nodes.
    I'm trying to figure out why the WDP is kept in this 'dirty state' when the page is reloaded.
    Thanks,
    Pietro.

    Hi Pietro,
    a reload of the Browser causes every time a reload of WDJ-Application. That means the content in the wdDoInit-Method is executed and the UI-Input elements are in initial state.
    If you want to store the selection in the Input fields and droodowns the only way is to store that in the session.
    Here is an example to do that.
    WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE, "ABC", "someValue");
    Than you have to read this in the init-Methods.
    WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE, "ABC");
    Regards
    Gunter

  • Photomatix plug-in's HDR merged image has suddenly stopped showing up as part of the stack, yet when I repeat the merge it warns that these images are already merged. I have the merged image labeled with a HDR suffix.

    Photomatix plug-in's HDR merged image has suddenly stopped showing up as part of the stack, yet when I repeat the merge it warns that these images are already merged. I have the merged image labeled with a HDR suffix. Worked fine until now. Thanks

    I am not sure what's happening with IE9 (no live site) but I had real problems viewing your code in Live View - until I removed the HTML comment marked below. Basically your site was viewable in Design View but as soon a I hit Live view, it disappeared - much like IE9. See if removing the comment solves your issue.
    <style type="text/css">
    <!-- /*Remove this */
    body {
        margin: 0;
        padding: 0;
        color: #000;
        background:url(Images/websitebackgroundhomee.jpg) repeat scroll 0 0;
        font-family: David;
        font-size: 15px;
        height:100%;

  • N unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    some one can help me please
    i have no idea what i must to do.
    an unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    The Exception Handler gave all the info that you need. No need to print the whole stack trace.
    The exception handler says
    Exception Details: java.lang.IllegalArgumentException
    TABLE1.NAME
    Look in the session bean (assuming that is where your underlying rowset is). Look in the _init() method for statements similar to the following:
    personRowSet.setCommand("SELECT * FROM TRAVEL.PERSON");
    personRowSet.setTableName("PERSON");
    What do you have?

  • How can I increase the hard limit of the stack size?

    Hi,
    My process gives an error of segmentation fault (SIGSEGV) that is caused because the stack limit is reached. I have a doubt about how to increase the stack size. I have tried change it with "ulimit - hard" but this size is 65532kb, and is very low for my process. How can I increase the hard limit?
    Thanks.

    When last I checked, the kernel had a fixed stack size limit.
    Do you have the source code to this application? If so, [see this Tiger stack size article|http://homepage.mac.com/eric.c/hpc/contents/documentation/How%20to%20in crease%20the%20stack%20size%20on%20Mac%20OS%20X.pdf], and specifically have a look at the +ld -stack_size+ mechanism; rebuild the code with a bigger limit.
    Entirely FWIW, this question would be more typical over in the developer forums or maybe in the Unix forum if you don't have Apple developer access. Better audience for application development and for software-related questions over there.

  • Question about documents folder in the "stacks"

    Hey everyone. Here is my question.....In my documents folder that is in the stacks section there is one labeled iChats (Which of course stores my iChat conversations)
    I would like to know if I can remove it from stacks but leave it on my hard drive? Basically, does everything I put in my documents folder in the HD show up in the stacks documents folder? Is there another place where I can put some of these items that I do not want to appear in the stacks?
    Thanks,
    Steve

    Not that one, if you want iChat to save the chats

  • Not Breaking the loop but how to continue with the next iteration in a For

    Hi all
    i have the following piece of code
    Please let me know, what is the /*some construct*/ which will not break the loop but goes to the next iteration skipping Login b
    Loop
    Login A
    /*some construct*/
    Login B
    End loop;
    P.S
    I should do this without Label or Exception ... I am using oracle 8i
    Thanks
    Hariharan
    T

    An [url http://www.oracle.com/pls/tahiti/tahiti.tabbed?section=48911]IF statement?
    loop
      login_a;
      if false
      then
        login_b;
      end if;
    end loop;Regards,
    Rob.

  • The stack sub menu does not enable for stacked photos in elements organizer 13 on windows 8.1

    The stack sub menu does not enable for stacked photos in elements organizer 13 on windows 8.1.
    Has anyone else experienced this?
    I stacked some photos, now I cannot expand them or unstack them in the organizer.
    This is for both auto and manual stacking.

    Please press Ctrl+D to move to the older grid and now the stack option should be enabled.
    Thanks,
    Anwesha

Maybe you are looking for

  • Multiprovider - BI planning - to which cube will be data save

    Hello, I solve the problem with multiprovider in BI planning. We have about 10 infocube connect in one Multiprovider. How can I ensure that the right data will be save to the right Infocube? I try it with Characteristic relationship but I have proble

  • Upload XML to internal table and vice versa in SAP 4.6C

    Hi,    Happy New Year to you all!    We are using 46C and I am beginning to learn about XML. We have a requirement to (1) upload an XML file into an internal table as well as (2) create an XML file from an internal table.    I read some of the posted

  • 17" Intel iMac

    I am getting a new 17" intel iMac next week. I am switching from an iMac G5 due to fan noise. I understand these machines are much quiter than the G5's. Could anyone who has used both machines share their experiences in this area?

  • Custom checks on appraisee selection

    Hi all, I'm using ECC 6 and appraisal catalog PHAP_CATALOG_PA. I need to add some custom checks when selecting the appraisee on a custom template when the appraiser clicks on the first pushbutton of the process (eg "Set Improvemente needs") even if t

  • Importing a class i made

    i have a silly question. let's say i've created a class called ClassOne.java and I want to create an instance of it in ClassTwo.java I've tried making a package and being able to access the first class but it keeps telling me that it cannot resolve s