1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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,276
    Likes Received:
    364
    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