arraylist help

Discussion in 'Java' started by kodirl, Aug 12, 2006.

  1. kodirl

    kodirl New Member

    Joined:
    Aug 12, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    2 questions I do not have aclue about the 1st one do not know where to start.Second one I attempted but I do not know the code for staying on the first item and checking every other item against it to see if there are any duplicates.So can sum 1 pls help thanks


    import java.util.ArrayList;
    class ArrayListExtra extends ArrayList
    {
    Q1.
    public boolean occursUpTo( Object query, int limit)
    //does 'query' occur amongst the first 'limit' items in this 'ArrayListExtra' object?
    {





    }

    }

    Q2.
    public void removeDuplicates( )
    //remove all duplicate items from this ArrayListExtra object,
    //so that it now contains exactly one occurrence of each item
    {
    for( int i=0;i<this.size( );i ++)
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I could not get what you are asking can you frame your questions a bit in a better way.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice