Results 1 to 3 of 3

Thread: Array List

  1. #1
    mashyum is offline Member
    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0

    Post Array List

    hello everyone..

    i need your help to extract the element in array list..
    Vector<int[]> phrasecordinates = CalculatePhraseCordinates(renderedop.getSourceImag e(0),awordlinecordinates);
    System.gc();

    if (phrasecordinates != null)
    {
    Vector<RenderedOp> temp_line = new Vector<RenderedOp>();
    System.out.println("Start checking line");
    for (int j=0;j<phrasecordinates.size() ;j++)
    {
    int blockcord[] = phrasecordinates.get(j);
    int sortVector[] = phrasecordinates.get(j);

    for(int c =0; c< sortVector.length; c++)
    {
    System.out.print(" "+sortVector[c]);

    }
    there is program that i had been created to list all the element,now i want to extract only 4 element in the array list..
    thanks for your help..;)

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  3. #3
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    OK, first of all, Vector and ArrayList do the same thing, but they are not the same. I suggest using ArrayList, since Vector is synchronized for threading, and you are not using threads.

    Second, you are creating Vectors all over, and you don't even use half of them. That tells me you are not quite sure what you are trying to accomplish.

    Third, System.gc() is unnecessary. The system will gc itself as needed, and doing gc right before you shut the system down is not accomplishing anything.

    Here's something helpful, after all my criticism.

    Get out a piece of paper and a pencil. Actually, at work, I have a dry-erase board next to my desk. Draw a picture of what you want to accomplish, or write it out in plain language, so that a non-programmer could understand. When your picture or written description simple and clear, then you know you understand what you want to accomplish. Turning that into code is then relatively simple.

Similar Threads

  1. Array List
    By mprentice84 in forum New To Java
    Replies: 2
    Last Post: 02-20-2009, 03:12 AM
  2. array list help
    By dorno83 in forum New To Java
    Replies: 9
    Last Post: 11-07-2008, 10:56 AM
  3. Array List problem
    By kurenai in forum New To Java
    Replies: 2
    Last Post: 06-25-2008, 08:30 AM
  4. How to convert List to Array
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 11:37 PM
  5. using an Array list
    By toad in forum New To Java
    Replies: 1
    Last Post: 11-18-2007, 10:08 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •