Iterating over strange object

this must be pretty simple but i can't figure out what to do:
I have a class defined like this:
public IndexExample  (String infile){
          Map<String,TreeSet> IndexExample = new TreeMap<String,TreeSet>();
.IndexExample is not empty now i want to run over the Map, and for each string run on the TreeSet, I though about something like this:
however the bolded stuff gives me:
"The method entrySet() is undefined for the type IndexExample"
what should i do?
[u]Set s = this.entrySet();[/u]
          Iterator iter1 = s.iterator();
        while (iter1.hasNext()){
            Map.Entry m = (Map.Entry)iter1.next();
            String key = (String)m.getKey();
            TreeSet pages = (TreeSet)m.getValue();
            Iterator iter2 = pages.iterator();
             }thanks
Eran

thank you all
but what i didn't mention (oopse)
that the first piece of code is the constructor for the class.
the second piece of code is some method.
but it doesn't let me use the method entrySet();
thanks in advance...
i put my code again:
import java.io.*;
import java.util.*;
public class IndexExample{
     final static char DELIMITER = ';';
//constructor:
     public IndexExample  (String infile){
          Map<String,TreeSet> IndexExample = new TreeMap<String,TreeSet>();
           try {
                BufferedReader in = new BufferedReader(new FileReader(infile));
                 String line;
                 while ((line = in.readLine()) != null) {
                     int delimiterIndex = line.indexOf(DELIMITER);
                     if (delimiterIndex < 0) {
                          continue;
                     String argument1 = line.substring(0,delimiterIndex-1);
                     String argument2 = line.substring(delimiterIndex+1,line.length());
                     String key = (argument1).trim();
                     Integer pageNumber = new Integer(argument2.trim());
                     TreeSet<Integer> pages = new TreeSet();
                     if (IndexExample.containsKey(key)) {
                          pages = IndexExample.get(key);
                     else {
                          pages = new TreeSet();
                     pages.add(pageNumber);
                     IndexExample.put(key,pages);
                 in.close();
             catch (IOException e) {
//some method
     public void toFile(String outFile){
          PrintWriter out = new PrintWriter(new FileWriter(outFile));
          Set s = this.entrySet();
          Iterator iter1 = s.iterator();
        while (iter1.hasNext()){
             Map.Entry m = (Map.Entry)iter1.next();
            String key = (String)m.getKey();
            TreeSet pages = (TreeSet)m.getValue();
            Iterator iter2 = pages.iterator();
            out.print(key + ", ");
             while (iter2.hasNext()){
                  int i = (Integer)iter2.next();
                  out.print(i + " ");
             out.println("");
        out.close();
        }

Similar Messages

  • [SOLVED] Iteration over a BPM Object.

    Hi guys, here i'm trying to solve a problem. May be simple, but i cant iterate over a BPM object without using the fuego taglibs.
    I need to iterate over the object X. The X object have one attribute, called itens, that is a group with values.
    In my JSP, using the code, works:
    <tr><td><b>Objeto.codigo:</b></td><td><f:fieldValue att="x.code" onlyValue="true"/></td></tr>
    <tr><td><b>Objeto.nome:</b></td><td><f:fieldValue att="x.name" onlyValue="true"/></td></tr>
    <tr><td><b>Objeto.item1:</b></td><td><f:fieldValue att="x.itens[0].description" onlyValue="true"/></td></tr>
    I have tried a conjuction with a <c:forEach> to iterate over the x.itens attribute without success, like this
    <c:forEach var="item" items="${x.itens}">
    ${item.description}
    </c:forEach>
    With JSP EL, there's a way to access this attribute without workarounds?
    Thanks!
    Thiago
    Edited by: user10128107 on 08/01/2009 04:04
    It was the use of the core taglib...
    Edited by: user10128107 on 08/01/2009 05:49

    madeqx wrote:
    Will this piece of code be significantly slower than iteration over an ArrayList?a) No. Iteration is O(n) in both cases.
    b) Irrelevant. If your design calls for a map, use a map, and if it calls for a list, use a list. The two serve entirely different purposes, and we don't choose between map and list for performance reasons.

  • Is iteration over a HashMap significantly slower than an ArrayList?

    Will this piece of code be significantly slower than iteration over an ArrayList?
    for(Object o : myMap.values()){
    I'm expecting the map to contain roughly between 10 and 50 elements.
    thanks,

    madeqx wrote:
    Will this piece of code be significantly slower than iteration over an ArrayList?a) No. Iteration is O(n) in both cases.
    b) Irrelevant. If your design calls for a map, use a map, and if it calls for a list, use a list. The two serve entirely different purposes, and we don't choose between map and list for performance reasons.

  • How do I remove the grid map over an object when working in 3D?

    I am working through Adobe's Photoshop CS6 Classroom in a Book, Section 12 - Working with 3D Images.
    So far I have found it all fairly straight forward and very useful.
    I am at a point where I am applying textures and materials to my objects, however I cannot seem to find out how to remove the grid that has mapped itself over the objects. I have included a image to illustrate.
    Can anyone help?
    What is the command that will hide these grid maps?!
    Thanks so much in advance.

    I went into YouTube as well, and indeed: It didn't remove the white background.
    Then I went into Photoshop and was surprised: It was able to remove the white background by just playing around with the Magic Wand Tool. I also went into other programmes similar to Photoshop and was excited that there were connatural ways to remove the white background. Finally, I went into Illustrator and observed that the clipping path route worked. Even in CS6.
    Not sure why it didn't work for you.

  • OSB - Iterating over large XML files with content streaming

    Hi @ll
    I have to iterate over all item in large XML files and insert into a oracle database.
    The file is about 200 MB and contains around 500'000, and I am using OSB 10gR3.
    The XML structure is something like this:
    <allItems>
    <item>.....</item>
    <item>.....</item>
    <item>.....</item>
    <item>.....</item>
    <item>.....</item>
    </allItems>
    Actually I thought about using a proxy service with enabled content streaming and a "for each" action for iterating
    over all items. But for this the whole XML structure has to be materialized into a variable otherwise it is not possible!
    More about streaming large files can be found here:
    [http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/context.html#large_messages]
    There is written "When you enable streaming for large message processing, you cannot use the ... for each...".
    And for accessing single items you should should use an assign action with a xpath like "$body/allItems/item[1]";
    this works fine and not the whole XML stream has to be materialized.
    So my idea was to use the "for each" action and processing seqeuntially all items with a xpath like:
    $body/allItems/item[$counter]
    But the "for each" action just allows iterating over a sequence of xml items by defining an selection xpath
    and the variable that contains all items. I would like to have a "repeat until" construct that iterates as long
    $body/allItems/item[$counter] returns not null. Or can I use the "for each" action differently?
    Does the OSB provides any other iterating mechanism? I know there is this spli-join construct that supports
    different looping techniques, but as far I know it does not support content streaming, is this correct?
    Did I miss somehting?
    Thanks a lot for helping!
    Cheers
    Dani
    Edited by: user10095731 on 29.07.2009 06:41

    Hi Dani,
    Yes, according to me this would be the best approach. You can use content-streaming to pass this large xml to ejb and once it passes successfully EJB should operate on this. If you want any result back (for further routing), you can get it back from EJB.
    EJB gives you power of java to process this file and from java perspective 150 MB is not a very LARGE data. Ensure that you are using buffering. Check out this link for an explanation on Java IO Streams and, in particular, buffered streams -
    http://java.sun.com/developer/technicalArticles/Streams/ProgIOStreams/
    Try dom4J with xpp (XML Pull Parser) parser in case you have parsing requirement. We had worked with 1.2GB file using this technique.
    Regards,
    Anuj

  • Firefox 4 isn't turning the cursor to pointer mode when it goes over an object in a flash movie that has the 'buttonMode' property set to 'true'. Can this be fixed?

    I make flash games for a living, and normally when I set something to 'buttonMode' inside Flash, the cursor turns into the pointer when it rolls over the object. This is how it was in the previous version of FF and how it is in Safari and IE.
    But this isn't happening in FF4. The cursor is not turning into the pointer. Kind of a bummer. This is a tool so that the kids who play the games I make know when something is clickable.

    It seems to be an issue, I just posted the same question. I hope they fix it, its a bit annoying. I wonder if they had ex-Microsoft employees working on the updates for 4.0?

  • Is it possible to hide the yellow box that appears when you scroll over any object in the form?

    Is it possible to hide the yellow box that appears when you scroll over any object in the form? This box contains the item name or caption.

    Hi,
    Under Tools ... Options ... Workspace, there is an option "Display Object Name Tool Tips While Pointing".
    Try clearing that.
    Bruce

  • External Microsoft USB Mouse "slows" over clickable objects

    I've just gotten around to plugging in a wireless USB mouse from Microsoft into my iBook. Everything is fine except that when I turn sensitivity to the highest setting (the way I like it and have it set on my touchpad), the cursor slows down over clickable objects.
    Is there a way around this? The touchpad doesn't have this problem.
    Thanks,
    James

    Thanks for the feedback and sharing the comments from Apple. That kind of information helps other users!
    Some other things you can try.
    Uninstall the LCC using the original installer.
    Then do a manual search of the Library files and delete plist files showing Logitech or LCC in the file name. (Find and Spotlight do not search the libraries by default so you'll need to navigate to the User and System libraries manually before doing the search.)
    I used to have a Logitech track ball and I did notice that the LCC software sometimes did odd things I didn't like. After uninstalling the LCC and the plist files, the trackball worked just fine with the default Apple drivers.
    The one sure way to get rid of the LCC drivers is to do an Erase and Install of the OS - It is a lot of work....
    Short of a full Erase and Install, after manually removing the LCC drivers and plists, you can download and run the 10.5.5 Combo updater which may (or may not) correct faulty driver issues.
    http://support.apple.com/downloads/MacOS_X_10_5_5_ComboUpdate
    Hope that helps.

  • How to use retouch/clone brushes with loupe staying over the object

    I would like to keep the loupe stationary over an object while I use my Aperture retouch/clone brush. Help!

     3 Go to the port forwarding section and copy down the Applied Rules. 
    Example:  
    Network Computer/Device: 192.168.1.100:63145
    Application & Ports Forward:  Application UDP Any -> 6347  
    Note: There may be up to three entries for each one of your Set Top Boxes.G
    Your display obviously is not like mine as mine does not dosplay the port associated with the ip address
    whatever, the STB's start at 192.168.1.100 and icement by 1 for each
    the port addr's will be 63145 alo incrementing by 1
    there is 1 entry for each in my pf list
    however each ip addr also has a port entry starting at 35000 also incrementing by 1 for each ip addr
    For some unknow reason these are duplicated e.g I appear to have 11 entries exaactly the same for each stb and as the fios services rules have no action switc there is nowhere to delete the extraneous garbage.
    Why do you clone the mac addr??

  • Iterating through View Object RowIterator Bug.

    I use this code to loop through the rows of a view object (As described in javadoc of RowIteratior).
    public String checkIterations() {
    String res = "Iterated through : ";
    RowIterator view = this.getDepartmentsView1();
    view.reset();
    Row row;
    while ((row = view.next()) != null) {
    System.out.println("rownum: " + row.getAttribute("RowNum"));
    res += row.getAttribute("RowNum") + " ";
    return res;
    Yet this code never goes through the first row if the executequery has been performed for view object.
    details:
    [http://adfbugs.blogspot.com/2009/07/iterating-through-view-object.html]
    Is this a bug?
    Edited by: mkonio on Jul 28, 2009 11:41 PM

    Thanks Andrejus and Steve.
    Its a development bug
    problem and solution described in:
    Fusion Developer's Guide for Oracle ADF
    9.7.6 What You May Need to Know About Programmatic Row Set Iteration

  • Two unexpected Locals variables when iterating over array of containers​.

    Hi,
    I iterate over an array of containers. In the ForEach loop step variables format I have defined two variables; one is current offset, second one is current element.
    The loop works fine.
    However, during the debug process, I've spotted two new Locals variables called __ElementSibling0 (type: number) and __ForEachReleaser0 (type: obj. reference) created silently by TS as soon as I start iterating over my array. What are they?
    Do they exist because:
    I'm iterating over an array of containers, or
    I use  the _currentElement_Freq variable, or
    it always like that?
    Solved!
    Go to Solution.

    Those are used by the implementation of the For Each step. You can see them only because you have enabled the Show Hidden Properties setting.
    You can safely ignore their presence.

  • Dynamic iterating over table columns

    hello there,
    i have to create a string depending on the values in my table columns. this string creation is used on different tables with different number of columns and different column types.
    so i want to write a procedure which does simplified the following:
    1. create dynamic rowtype with a select statement
    2. iterate over rowtype columns and append column value to a string
    3. insert the created string in another table.
    by trying this dynamically for any table i run in the following two issues:
    1. creation of a rowtype needs the tabletype
    2. no iterating over rowtype possible
    are their any ideas to solve this issue. or do i have to write a procedure for every table i use.
    regards,
    rené

    You can do it with a single, generic procedure using DBMS_SQL.
    Joe Fuda
    SQL Snippets

  • Cursor slows down over clickable objects

    hello,
    how do i turn off the feature which causes the cursor to slow down over clickable objects? in system preferences i click on the mouse icon. in that window i set the "tracking speed" to fast. this works except for when the cursor rolls over a clickable object. for example the red yellow and green circles in the top left of a window will reduce the "tracking speed" when the cursor moves over top of them. how do i turn this feature off?
    thanks
    any help is greatly appreciated!
    if you need more info just ask

    -bump-
    is it not possible to turn this feature off?

  • Any performance overhead if we get iterator over values stored in map

    Hi Everybody,
    Is there any performance overhead if we get iterator over values stored in map. like this
    Iterator itr = rolesMap.values().iterator();
    if yes please explain...thanks in advance.

    ejp wrote:
    That's rather out of date. It is how Hashtable works, but as regards HashMap it isn't. The keySet() iterator and the values() iterator are both written in terms of the entrySet() iterator. There is no skipping over unused slots.Out of date? In that case there's been a recent advance in hashed data structures I've missed.
    Or the HashMap implementation has been recently changed to internally link entries to improve iteration performance. I doubt that because such a list would degrade the performance of the HashMap in other ways and that's unacceptable (and unnecessary because of LinkedHashMap).
    Besides, what I said is in the Java 6 API documentation to LinkedHashMap. It may be out of date but I doubt it.
    So here we are with a fact of nature: Any iteration of a hash based data structure will be proportional to capacity rather than the number of entries, unless a supportive list style data structure is introduced to overcome this.

  • Iterating over the Values returned from a HashMap

    Hi,
    I have a HashMap which stores some Strings as Keys and their corresponding Values are a Vector of Strings.
    for eg. one (Key, Value) pair is
    (String1, [StringA, StringB, StringC, ........])
    I understand that I can read the Vector Values by iterating over the HashMap using the ".entrySet()" and "Map.Entry" operations.
    My problem is I am not able to iterate through the Vector values returned by the ".getValue( )" method.
    can anyone please give some hints as to where I am commiting an error, or if I need to cast my values in some manner to iterate over them?
    thanks in advance

    can anyone please give some hints as to where I am commiting an errorSomewhere in your code. Post the smallest complete example which demonstrates the problem, then people may be able to give more specific help.

Maybe you are looking for

  • Increase the field width in ALV grid display

    hi My problem is that when i am trying to print data through REUSE_ALV_GRID_DISPLAY, a particular field which contain message is being truncated, i used ls_layout-colwidth_optimiser as 'X' and also t_fieldcat-outputlen = 1000, but still i am having t

  • Upgrading Acrobat Standard 9  to Standart XI

    To upgrade Acrobat Standard 9 to Standard XI; Australian website, cost AU$199.00 US website, cost US$139.00 Why the cost diparity? Is there a difference in software? Why souldn't I upgrade from the US website and save 1/3 of the price?

  • Error Installing Yosemite

    The download is complete but it keeps giving me an error of "This disk has S.M.A.R.T. errors.  This disk has a hardware problem that can't be repaired.  Back up as much of the data as possible and replace the disk." I need to know what this means an

  • Just updated to IOS7,  now I have no sound.  Checked settings etc, and still no sound,,, Help!

    I just updated my iPad to IOS7, and now I have no sound.

  • REFX report for earliest notice in RECN

    Dear Experts, In RECN >Term >Notice >Individual period regulation there is a field to capture "Earliest Notice On". We normally have lease-out contracts for a period of 9 years with a lock-in period of initial 3 years during which period termination