Sort 2 Vector containg Objects

I have 2 Vector , both contains objects
I merge both the vector and make one Vector of Objects.
Now i want to sort the Vector with the date filed.
Can anybody write the code sorting the vector of objects on the basis of Date.?

I have Vector name Employee( this contais object)
Attribute: Name , Age , Date(on which user make entry:sysdate)
like :
Vector Employee= new Vector();
Collections.sort(list,comparator);
Plz help me how to use this Collections.sort(list,comparator);?
What should be the code for comparator.?

Similar Messages

  • Sort a vector of objects by one of its attributes

    Hi all!
    I have created this class:
    public class Client {
    private int numero;
    private double tempsEntrada;
    private double tempsServei;
    private double tempsIniciSessio;
    private char tipus;
    * Creates a new instance of Client
    public Client(int num, double temp,double servei, char tip) {
    numero = num;
    arrivalTime = temp;
    serviceTime = servei;
    tipus = tip;
    public char getTipus()
    return tipus;
    public int getNumero()
    return numero;
    public double getTempsEntrada()
    return arrivalTime;
    public double getTempsServei()
    return serviceTime;
    Now I've done a java vector of this object, and I want to sort it by arrivalTime.
    The class comparer looks like this
    public class Comparer implements Comparator {
    public int compare(Object obj1, Object obj2)
    double temps1 = ((Client)obj1).getTempsEntrada();
    double temps2 = ((Client)obj2).getTempsEntrada();
    return (int)(temps1 - temps2);
    now when I do Collections.sort(vector);
    this is the error reported:
    Exception in thread "main" java.lang.ClassCastException: cafevirtual.Client cannot be cast to java.lang.Comparable
    at java.util.Arrays.mergeSort(Arrays.java:1144)
    at java.util.Arrays.mergeSort(Arrays.java:1155)
    at java.util.Arrays.mergeSort(Arrays.java:1155)
    at java.util.Arrays.sort(Arrays.java:1079)
    at java.util.Collections.sort(Collections.java:117)
    at cafevirtual.Main.main(Main.java:76)
    Java Result: 1
    what's wrong?
    thanks!

    Your Client class does not implement Comparable. You have to specify the Comparator to use: Collections.sort(vector, new Comparer());

  • Sorting a vector of objects using attribute of object class as comparator

    i would like to sort a vector of objects using an attribute of object class as comparator. let me explain, i'm not sure to be clear.
    class MyObject{
    String name;
    int value1;
    int value2;
    int value3;
    i've got a Vector made of MyObject objects, and i would sort it, for instance, into ascending numerical order of the value1 attribute. Could someone help me please?
    KINSKI.

    Vector does not implement a sorted collection, so you can't use a Comparator. Why don't you use a TreeSet? Then you couldclass MyObject
      String name;
      int value1;
      int value2;
      int value3;
      // Override equals() in this class to match what our comparator does
      boolean equals (Object cand)
        // Verify comparability; this will also allow subclasses.
        if (cand !instanceof MyObject)
          throw new ClassCastException();
        return value1 = cand.value1;
      // Provide the comparator for this class. Make it static; instance not required
      static Comparator getComparator ()
        // Return this class's comparator
        return new MyClassComparator();
      // Define a comparator for this class
      private static class MyClassComparator implements Comparator
        compare (Object cand1, Object cand2)
          // Verify comparability; this will also allow subclasses.
          if ((cand1 !instanceof MyObject) || (cand2 !instanceof MyObject))
            throw new ClassCastException();
          // Compare. Less-than return -1
          if ((MyObject) cand1.value1 < (MyObject) cand2.value1))
            return -1;
          // Greater-than return 1
          else if ((MyObject) cand1.value1 > (MyObject) cand2.value1))
            return 1;
          // Equal-to return 0.
          else
            return 0;
    }then just pass MyObject.getComparator() (you don't need to create an instance) when you create the TreeSet.

  • Merging two sorted Vectors into one

    I wish to write a function that will accept two Vectors which are sorted and merge them into a single sorted Vector. I plan to use the compareTo() function to perform the comparisons between objects. I want the function to do this task for Vectors containing Integer, String, or any User Defined Classs (both the vectors will be containing objects of same class though).
    However, I am unable to do this because whether I use an iterator or write a loop to acces the elements of the Vector, I am required to typecast the returned object. I am using J2SE 1.4.2
    1 Vector mergeSortedVectors(Vector a, Vector b) {
    2         Vector c = new Vector();
    3         int p1=0, p2=0;
    4         while(p1<a.size() && p2<b.size()) {
    5                int result = ((Object)a.get(p1++)).compareTo((Object)b.get(p2++));
    6                // insertion logic
    7         }
    8 }Line no 5 gives me a compile error: Object.compareTo() not found
    Please help

    Cast it to Comparable instead of Object.

  • Sort Vector with quicksort & compareTo

    hmm, maybe someone could give me a hint.
    the code looks like this:
    Vector wbVec = new Vector(500,50); // filled with Stringobjects
    quickSort(wbVec);
         public void quickSort(Vector wbVec){
              sort(wbVec,0,(wbVec.size()-1));
         public void sort(Vector wbVec, int links, int rechts){
              int auf = links;
              int ab = rechts;
              final Object ausgewaehlt = wbVec.elementAt((links+rechts)/2);
              do{
                   while(wbVec.elementAt(auf).compareTo(ausgewaehlt)){
                        auf++;
                   while(ausgewaehlt.compareTo(wbVec.elementAt(ab))){
                        ab--;
                   if(auf<=ab){
                        final Object temp = wbVec.elementAt(auf);
                        wbVec.setElementAt(wbVec.elementAt(ab),auf);
                        wbVec.setElementAt(temp,ab);
                        auf++;
                        ab--;
              }while(auf<=ab);
              if(links < ab){
                   sort(wbVec,links,ab);
              if(auf < rechts){
                   sort(wbVec,auf,rechts);
    the compiler just says "cannot resolve symbol: method compareTo"
    first: why? i probably got the crap all wrong but please gimme a hint
    2nd: what shall i change to make it work?
    pleeaaassee!!! i am still new to this stuff so i am sorry in case my questions are completely stupid :)

    the compiler just says "cannot resolve symbol: method compareTo"
    first: why? i probably got the crap all wrong but please gimme a hint
    2nd: what shall i change to make it work?As far as the compiler's concerned, "wbVec.elementAt(auf)" is of type Object, and Object doesn't have a compareTo method. You'll need to do ((Comparable)wbVec.elementAt(auf)) instead.

  • Program error when attempting to edit a vector smart object. Help?

    I'm running Photoshop CS6 (13.0.1) 64bit on a MacBook Pro running OS X Lion. About 60% of the time when I try to double click a vector smart object instead of opening it up in Illustrator I get an error that says, "Could not edit original smart object because of program error." This most recent time it was a smart object from vector data I copied and pasted from Illustrator into Photoshop.
    Any idea why this is happening and how I can fix it?
    Thanks.

    Hi there, 
    I got this problem when I installed Adob master collection Over CS 5.
    I had children book story storis which created in Adobe illustrator CS 5 and I created art boards in Adobe photoshop cs 5.
    After installting CS 6 i tried to edit the smart objects and it was not opeinging the smart object file in Illustrator.
    I did some tests.
    1) Right click on smart object layer and click export contents. Save on desktopp or anywhere you want. (I saved on desktop)
    2) I had this file on my desktop (Vector Smart Object10.ai) but it didn't show any icon, which program should open this type of file.
    3) Double click on the file and it pop up a extension window 'Click on change and select adobe illustrator' and press OK.
    4) Go back to your photoshop file and right click on smart object layer and click dit content. now this time it opens up assets in illustrator.
    ENJOY!
    www.4d-studios.co.uk

  • Is it possible to export Vector Smart Objects as vector SVG files from Photoshop CC 2014?

    I have Vector Smart Objects copied from Illustrator and pasted into Photoshop. I would like to export them as vector SVG files (using Generator or Extract Assets). I can add the .svg extension to the layer and actually export an SVG just fine. The problem is any SVG I have exported have all been raster images. It defeats the purpose of having that as an option as far as I'm concerned.
    I remember watching and listening to keynotes and other speakers at Adobe MAX 2014 who said it was so powerful and amazing to create SVG files from Photoshop. If we're still exporting raster SVG files from Photoshop...that's not very impressive or exciting--especially since this era of modern web development benefits greatly from using vector SVG files.
    I understand that Shape Layers can be exported as vector SVG files but that seems very limiting. I also realize that users can create some impressive vectors in Photoshop, but that is not optimal. Illustrator is a better tool for creating vectors and I normally use Photoshop and Illustrator side-by-side. I know that vector SVG files can be exported from Illustrator but that isn't as user friendly and convenient as utilizing Photoshop > Generator > Reflow.
    My idea was to create my assets in Illustrator, paste them into Photoshop as Vector Smart Objects, set up my layout, and then use the Generator/Reflow method or Extract Assets to get a new web design started.
    Maybe I misunderstood what the speakers at Adobe MAX had said. Perhaps it's just user error and I'm just missing something simple (it happens).
    Photoshop CC 2014 notes the following under Help > System Info:
    Adobe Photoshop Version: 2014.2.2 20141204.r.310 2014/12/04:23:59:59 CL 994532  x64
    Operating System: Windows 8.1 64-bit
    Any help or suggestions would be greatly appreciated! Thank you in advance for your time.

    Not quite the same, but have a look at the new Libraries feature that came with 2014.2.2  I just tried it, and dragging a vector object into a library I created in Photoshop, was there in Illustrator.  This happens without having to close and reopen Illustrator.  Just use the drop down at the top of the Libraries panel (in Illustrator) to find your custom, or job specific library.

  • How to copy objects from Pages (5.5.1) and paste it into Photoshop as a vector smart object with high resolution?

    I recently have bought a new Macbook Pro (Version 10.10.1) with the OS X Yosemite. The computer comes with the new Pages (version 5.5.1).
    Here is the problem: I like to create artwork using the shapes on Pages. Previously, on my old mac, I used Pages 4.3 to create objects, which I would copy then paste to Photoshop and it would become a vector smart object. However, in the new Pages (version 5.5.1), when I copy objects, they would appear on Photoshop as instead, a layer and it would not be in full resolution.
    Also, I know there is nothing wrong with the Pages file itself because I have converted the document to PDF form and it is high resolution when inserted into Photoshop that way.
    Does anyone know how I can copy individual objects from Pages (5.5.1) and paste it into Photoshop as a vector smart object with high resolution as I have done before?
    Thanks!

    ghotiz wrote:
    copy the image and have it in a high-quality PNG format that does not include the background from the Pages document.
    Oh, well if you don't actually need vector objects then it looks like this is possible. As I said earlier, Pages is putting a PNG on the clipboard. I tested it and it does paste into Photoshop as a transparent layer, because I can see the transparent background of the pasted PNG graphic if I either turn off all layers behind it in Photoshop, or if I start a new Photoshop document to paste into but make sure I choose Transparent for the Background Contents in the New Document dialog.

  • PS opens vector smart object all pixilated

    I have this problem when using graphics from Illustrator as vector smart objects in Photoshop. I have followed tones of heated discussions on this but I haven't got any further. So here is what I do following the steps on the PS help: I copy graphics in AI and paste them in PS as smart object. A layer will be added that even has the name vector smart object but the graphic itself is all pixilated. Now the size of my PS-file is 150X150 Pixels with a resolution of 300. I need this size because I want to implement the file into my website and the layout requires this size for all my graphics. I would say it doesn't matter much what size the file is anyway since according to the PS help whatever vector smart object I place in Photoshop it won't change image quality when transformed. Therefor I'd say that not even the small file should be a problem here. But obviously there is something not working... because even when, to compare, I paste the graphic as pixel it shows the same result. Strange enough that I have used this vector smart objects before and it worked just fine... So I tried to paste the graphic in different ways, saving it as pdf in AI and then placing it in PS, insert it directly as smart object, making sure the file handling and clipboard references are adjusted, and finally after no success trashing the preferences in both applications. Still not closer to a satisfying result. I attach the graphics (first the AI graphic, then the vector smart object from PS) to show the difference and maybe there is someone out there that can tell what I am doing wrong. By the way I just converted the files to jpegs to post them here so the sizes might not match on the screen...

    One other thing to check...
    Are you viewing the display at 100%?
    Photoshop's OpenGL-based image resizing algorithms are smoother and fuzzier than they used to be (or than they are with OpenGL disabled).  What I'm getting at is that you may be perceiving fuzziness in the display that's not really there in the image.
    How does the fuzziness look if you zoom in a lot?
    -Noel

  • Keynote 6.0 vector smart object conversion to Photoshop CS6

    Hi,
    I upgraded to OS 10.9 and Keynote 6.0. In the previous version of Keynote, I was able to easily paste Keynote content (words, shapes, charts) into Photoshop CS6 & Illustrator CS6 as vector objects, of which the elements could be independently manipulated by releasing the clipping mask.
    However, with Keynote 6.0, it appears the content mentioned above pastes into CS6 software as .tiff files with no option to convert to a vector smart object?  Is there a way to force a vector object placement or does this new Keynote version no allow (and if so why eliminate such a convenient function as vector smart objects)?
    Thanks for the help...

    Hello  thanks for your answers,
    i posted this when i was upset because it was a very frustrating situation. I create Vector art in Illustrator and most of the times i just copy and paste them into Photoshop. I dont use Illustrator Cs6 because some Issues with the color Picker and because i Use Scriptographer alot. So i use Photoshop CS6 and Illustrator CS 5.
    Somehow recently i noticed this strange behaviour. When i close Illustrator completely and doubleclick the Layer in Photoshop it works fine.

  • Flv player is opening vector smart objects instead of illustrator.

    How do I re-associate vector smart objects in Photoshop to open in Illustrator as they did before the update?

    Editing smart objectrs uses the system wide associations, not the ones from Bridge, so you need to adjust that for the *.ai file type.
    Mylenium

  • Sort table of objects by object attribute

    Hi all,
    I would like to write method for sorting table of objects. Sorting will be according selected attribute of object.
    My problem is that when I have dynamic data, I'm not able to access attributes of object. Here is example in code. Problematic lines are commented.
    If you have any idea how to solve it, I will be very happy.
    CLASS lcl_reflection DEFINITION CREATE PUBLIC.
      PUBLIC SECTION.
        CLASS-METHODS: sort_object_table_by_field IMPORTING field_name   TYPE char72
                                                            direction    TYPE c DEFAULT 'A'
                                                  CHANGING  object_table TYPE table.
    ENDCLASS.                    "lcl_reflection DEFINITION
    CLASS lcl_reflection IMPLEMENTATION.
      METHOD sort_object_table_by_field.
        DATA: obj_type_desc   TYPE REF TO cl_abap_refdescr,
              cls_type_desc   TYPE REF TO cl_abap_classdescr,
              tab_type_desc   TYPE REF TO cl_abap_tabledescr,
              elm_type_desc   TYPE REF TO cl_abap_elemdescr,
              struc_type_desc TYPE REF TO cl_abap_structdescr,
              line            TYPE REF TO data,
              tab             TYPE REF TO data,
              object          TYPE REF TO data,
              lt_component TYPE cl_abap_structdescr=>component_table,
              ls_component LIKE LINE OF lt_component.
        FIELD-SYMBOLS: <object> TYPE any,
                       <tab>    TYPE table,
                       <line>   TYPE any,
                       <value>  TYPE any.
        READ TABLE object_table INDEX 1 ASSIGNING <object>.
        cls_type_desc ?= cl_abap_classdescr=>describe_by_object_ref( <object> ).
        elm_type_desc ?= cls_type_desc->get_attribute_type( field_name ).
        obj_type_desc ?= cl_abap_refdescr=>create( cls_type_desc ).
        UNASSIGN <object>.
        ls_component-name = 'key'.
        ls_component-type = elm_type_desc.
        APPEND ls_component TO lt_component.
        ls_component-name = 'object'.
        ls_component-type ?= obj_type_desc.
        APPEND ls_component TO lt_component.
        struc_type_desc ?= cl_abap_structdescr=>create( lt_component ).
        tab_type_desc ?= cl_abap_tabledescr=>create( p_line_type  = struc_type_desc
                                                     p_table_kind = cl_abap_tabledescr=>tablekind_std
                                                     p_unique     = abap_false ).
        REFRESH lt_component.
        CLEAR ls_component.
        CREATE DATA line TYPE HANDLE struc_type_desc.
        CREATE DATA tab TYPE HANDLE tab_type_desc.
        CREATE DATA object TYPE HANDLE obj_type_desc.
        ASSIGN tab->* TO <tab>.
        ASSIGN line->* TO <line>.
        ASSIGN object->* TO <object>.
        LOOP AT object_table REFERENCE INTO object.
          APPEND INITIAL LINE TO <tab> REFERENCE INTO line.
          ASSIGN object->* TO <value>.
          ASSIGN line->* TO <line>.
    *      <line>-key = <value>->(field_name).
    *      <line>-object = object.
        ENDLOOP.
    *    SORT <tab> BY key.
    *    LOOP AT <tab> REFERENCE INTO line.
    *      APPEND INITIAL LINE TO object_table REFERENCE INTO object.
    *      object = line-object.
    *    ENDLOOP.
      ENDMETHOD.                    "sort_object_table_by_field
    ENDCLASS.                    "lcl_reflection IMPLEMENTATION

    Ok guys, it's solved. It was little bit more complicated then I expected. Thanks for you help.
    METHOD sort_object_table_by_field.
        TYPES: t_object TYPE REF TO object.
        DATA: obj_type_desc   TYPE REF TO cl_abap_refdescr,
              cls_type_desc   TYPE REF TO cl_abap_classdescr,
              tab_type_desc   TYPE REF TO cl_abap_tabledescr,
              elm_type_desc   TYPE REF TO cl_abap_elemdescr,
              struc_type_desc TYPE REF TO cl_abap_structdescr,
              r_line          TYPE REF TO data,
              r_tab           TYPE REF TO data,
              r_object        TYPE REF TO data,
              r_obj           TYPE REF TO data,
              lt_component TYPE cl_abap_structdescr=>component_table,
              ls_component LIKE LINE OF lt_component.
        FIELD-SYMBOLS: <object>    TYPE any,
                       <obj>       TYPE REF TO object,
                       <tab>       TYPE table,
                       <line>      TYPE any,
                       <key>       TYPE any,
                       <fs_key>    TYPE any,
                       <fs_object> TYPE any.
        READ TABLE object_table INDEX 1 ASSIGNING <object>.
        cls_type_desc ?= cl_abap_classdescr=>describe_by_object_ref( <object> ).
        elm_type_desc ?= cls_type_desc->get_attribute_type( field_name ).
        obj_type_desc ?= cl_abap_refdescr=>create( cls_type_desc ).
        UNASSIGN <object>.
        ls_component-name = 'key'.
        ls_component-type = elm_type_desc.
        APPEND ls_component TO lt_component.
        ls_component-name = 'object'.
        ls_component-type ?= obj_type_desc.
        APPEND ls_component TO lt_component.
        struc_type_desc ?= cl_abap_structdescr=>create( lt_component ).
        tab_type_desc ?= cl_abap_tabledescr=>create( p_line_type  = struc_type_desc
                                                     p_table_kind = cl_abap_tabledescr=>tablekind_std
                                                     p_unique     = abap_false ).
        REFRESH lt_component.
        CLEAR ls_component.
        CREATE DATA r_line TYPE HANDLE struc_type_desc.
        CREATE DATA r_tab TYPE HANDLE tab_type_desc.
        CREATE DATA r_object TYPE HANDLE obj_type_desc.
        CREATE DATA r_obj TYPE REF TO object.
        ASSIGN r_tab->* TO <tab>.
        LOOP AT object_table REFERENCE INTO r_object.
          APPEND INITIAL LINE TO <tab> REFERENCE INTO r_line.
          ASSIGN r_object->* TO <object>.
          ASSIGN r_obj->* TO <obj>.
          MOVE <object> TO <obj>.
          ASSIGN <obj>->(field_name) TO <key>.
          ASSIGN r_line->* TO <line>.
          ASSIGN COMPONENT 'KEY' OF STRUCTURE <line> TO <fs_key>.
          ASSIGN COMPONENT 'OBJECT' OF STRUCTURE <line> TO <fs_object>.
          <fs_object> = <object>.
          <fs_key> = <key>.
        ENDLOOP.
        DATA: sort_field TYPE fieldname.
        sort_field = 'KEY'.
        SORT <tab> BY (sort_field).
        REFRESH object_table.
        LOOP AT <tab> REFERENCE INTO r_line.
          APPEND INITIAL LINE TO object_table REFERENCE INTO r_object.
          ASSIGN r_line->* TO <line>.
          ASSIGN r_object->* TO <object>.
          ASSIGN COMPONENT 'OBJECT' OF STRUCTURE <line> TO <fs_object>.
          <object> = <fs_object>.
        ENDLOOP.
      ENDMETHOD.

  • Vector of objects problem

    Hello All,
    I am trying out a program which uses vector of objects.It is throwing an exception when I compile it.The aim of the program is.
    for eg if we have a set of producers
    count =5
    P1 P2 P3 P4 P5
    7 8 9 10 11
    C1 C2 C3 C4 C5
    1 2 3 4 5
    store all those pairs of consumers and producers where (Ci <=Pi).
    Hash table keys will be of the form S0,S1,S2..SN
    in this Case SO should correspond to a vector which is (7 1),(8 1),(9,1),(10,1),(11,1)
    similarly
    S1 should be (8,1),(8,2) etc.
    I have tried writing the code it doesnt work why.
    Thanks.
    Regards.
    NP
    import java.io.*;
    import java.util.*;
    import java.lang.StrictMath;
    import java.util.ArrayList;
    class CollectionCache
    private final Map cache;
    public CollectionCache()
    cache=new Hashtable();
    public Collection put(Object key,Collection value)
    return(Collection)cache.put(key,value);
    public Collection get(Object key)
    return(Collection)cache.get(key);
    public class Participant
    boolean isProducer;
    double value;
    String name;
    static double resources_used;
    static int p=0;
    static int q=0;
    //static int[] final_index_pro=new int[100];
    //static int[] final_index_con=new int[100];
    public void set_is_pro_or_con(boolean ispro)
    isProducer=ispro;
    public boolean get_is_pro_or_con()
    return isProducer;
    public void set_is_pro_or_con_value(double value)
    this.value=value;
    public double get_is_pro_or_con_value()
    return value;
    public void set_is_pro_or_con_name(String name)
    this.name=name;
    public String get_is_pro_or_con_name()
    return name;
    public static void main(String args[]) throws IOException
    ArrayList Producer=new ArrayList();
    ArrayList Consumer=new ArrayList();
    Collection c=new Vector();
    int i;
    BufferedReader console= new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter the number of resources you want to input");
    String input=console.readLine();
    int count=Integer.parseInt(input);
    System.out.println(count);
    for(i=0;i<count;i++)
    Producer.add(i,new Participant());
    for(i=0;i<count;i++)
    Consumer.add(i,new Participant());
    System.out.println("Reading values into producer array");
    for(i=0;i<count;i++)
    ((Participant)Producer.get(i)).set_is_pro_or_con(true);
    String t="P"+ i;
    ((Participant)Producer.get(i)).set_is_pro_or_con_name(t);
    ((Participant)Producer.get(i)).set_is_pro_or_con_value((int)(StrictMath.random()*10 + 1));
    System.out.println("Reading values into consumer array");
    for(i=0;i<count;i++)
    ((Participant)Consumer.get(i)).set_is_pro_or_con(true);
    String t="P"+ i;
    ((Participant)Consumer.get(i)).set_is_pro_or_con_name(t);
    ((Participant)Consumer.get(i)).set_is_pro_or_con_value((int)(StrictMath.random()*10 + 1));
    //Making Graph topology
    System.out.println("producer array");
    for(i=0;i<count;i++)
    //System.out.println(dup_producer.get_is_pro_or_con());
    //System.out.println(dup_producer[i].get_is_pro_or_con_name());
    System.out.println(((Participant)Producer.get(i)).get_is_pro_or_con_value());
    System.out.println("consumer array");
    for(i=0;i<count;i++)
    //System.out.println(dup_consumer[i].get_is_pro_or_con());
    //System.out.println(dup_consumer[i].get_is_pro_or_con_name());
    System.out.println(((Participant)Consumer.get(i)).get_is_pro_or_con_value());
    System.out.println("Values Printed");
    //String s;
    CollectionCache cc=new CollectionCache();
    int j=0;
    while(j<count)
    for(i=0;i<count;i++)
    if( (((Participant)Consumer.get(j)).get_is_pro_or_con_value()) <= (((Participant)Producer.get(i)).get_is_pro_or_con_value()))
    c.add(Double.toString((((Participant)Consumer.get(j)).get_is_pro_or_con_value())));
    c.add(Double.toString((((Participant)Producer.get(i)).get_is_pro_or_con_value())));
    final Object s="S" +j;
    cc.put(s,c);
    j++;
    j=0;
    while(j<count)
    Collection value=cc.get("S" + j);
    if(value!=null)
    for(Iterator it=value.iterator(); ;it.next())
    System.out.println(it.next().toString());
    j++;

    Or if you want to keep it in as small a scope as possible:
    Iterator it = valu      e.iterator();
      while (it.hasNe                                                       xt()) {
        System.out.println(it
    .next
    }

  • [svn:fx-trunk] 7916: Last of the List PARB changes - selectedItems is now a Vector of Objects and selectedIndices is a Vector of Numbers .

    Revision: 7916
    Author:   [email protected]
    Date:     2009-06-17 09:04:51 -0700 (Wed, 17 Jun 2009)
    Log Message:
    Last of the List PARB changes - selectedItems is now a Vector of Objects and selectedIndices is a Vector of Numbers.
    Also, put alphabetized spark-manifest correctly after my last checkin.
    QA: Yes
    Doc: Yes
    Checkintests: Pass
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/List.as
        flex/sdk/trunk/frameworks/spark-manifest.xml

    Gordon, it looks like its been a while since you made this post.  Not sure how valid it is now...   I am particularly interested in the LigatureLevel.NONE value.  It seems that it is no longer supported.
    How do I turn of ligatures in the font rendering?
    My flex project involves trying to match the font rendering of Apache's Batik rendering of SVG and ligatures have been turned off in that codebase.  Is there any way (even roundabout) to turn ligatures off in flash?
    Thanks,
    Om

  • How do I print out a vector of objects?

    Hi,
    I am having trouble printing out the contents of my vector. Can somebody please help me out. Im trying to create a vector of objects. I keep getting output like this:
    There are 5 total classes
    5
    ClassObject@13f5d07
    Here is my code:
    //Test.java
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    public class Test {
            ClassObject co = new ClassObject();
            Vector vec = new Vector();
            public Test () throws Exception {
                    Read("input.dat");
            public void Read(String fileName) {
                    String num; //number of cells
                    String cells; //cell data
                    int x = 0;
                    try {
                            FileReader file = new FileReader(fileName);
                            BufferedReader in = new BufferedReader (file);
                            num = in.readLine();
                            int number = Integer.valueOf(num).intValue(); //convert string to int
                            System.out.println("There are " + number + " total classes");
                            while ((cells = in.readLine()) != null) {
                                    StringTokenizer st = new StringTokenizer(cells, "- ");
                                    while (st.hasMoreTokens()) {
                                           co.classNumber = Integer.valueOf(st.nextToken()).intValue();
                                           co.classRelation = Integer.valueOf(st.nextToken()).intValue();
                                          // System.out.println(co[x].classRelation);
                                           vec.addElement(co);
                                           x++;
                                    System.out.println("\n" + x);
                                    System.out.println(vec.lastElement());
                    catch (IOException e) {
                            System.out.println("cannot read file");
                            System.exit(0);
            public static void main (String[] args) throws Exception {
                    new Test ();
    //ClassObject.java
    import java.util.*;
    import java.lang.*;
    public class ClassObject {
            int classNumber;
            int classRelation;
    //input.dat
    5
    1-2 1-3 2-4 3-4 4-5Thanks!!!!!

    public class ClassObject
        int classNumber;
        int classRelation;
        public String toString()
            return classNumber + "-" + classRelation;
    }

Maybe you are looking for

  • New ATI Radeon HD 4870 Card

    I have been searching for the new ATI Radeon HD 4870 --- http://store.apple.com/us/product/MB999ZM/A --- graphics card online to upgrade my 2008 mac pro but it is backordered everywhere. I am told apple has bought them all up to upgrade the new 2009

  • It should be interface or class ?

    Friends, I have a major entity in my application. That entity is, u can say, heart of the what application does. Actually, clients can open up a case with supplier and that case is my main entity. Now that case can be of any type out of some 7 types.

  • Is there a "Flash or White Wash" transition effect in FCP?

    Hey guys, I'm trying to get a transition effect of a "white Wash or like a Flash" in FCP5? It's an effect you see on tv when people get a make over from looking bad to looking really cool with a transition that looks like a flash or white wash. Anyon

  • Loss of assigned color on OS X 10.7.2 and iCal 5.0.1

    Hello all, Has anyone run into an issue where iCal 5.0.1 looses its calendar color on a subscribed calendar? I have 3 subscribed calendars and only one of them has retained its original calendar color. The other 2 have defaulted to a light grey color

  • Accordion problems

    Hi, I have a fresh install ColdFusion 10 (latest updates) On a RedHat 6.1,6.2,6.3,6.4  Servers. Using Apache as a webserver. I can't get the following test code (Test 1 and Test 2) working.  Both are provided by Adobe. I have tried https://cf.support