Results 1 to 2 of 2

Thread: Need a filter

  1. #1
    revathi17 is offline Member
    Join Date
    Aug 2007
    Posts
    26
    Rep Power
    0

    Default Need a filter

    Hello,

    I have a requirement to build a filter which takes in some objects as inputs, filters it based on certain criteria and outputs in a specified format. I have to do this in core java....any ideas please??

  2. #2
    Join Date
    Aug 2007
    Posts
    25
    Rep Power
    0

    Default

    Um.

    Here:

    Java Code:
        public final class Filter 
        {
            private ArrayList<ObjectsToCompare> items;
            
            public Filter(ArrayList<ObjectsToCompare> items)
            {
                this.items = items;
            }
            
            public boolean compareTo(ObjectsToCompare ob)
            {
              
                for(Iterator i = items.iterator(); i.hasNext())
                {
                    if(((ObjectsToCompare)i.next()).criteriaToMeetEquals(ob.getCriteria()))
                        return true;
                    
                }
                
                return false;
            
            }
    Now implement it!

    Joe

Similar Threads

  1. servlet Filter problem
    By saint_jorjo in forum New To Java
    Replies: 1
    Last Post: 03-13-2008, 01:05 PM
  2. Object filter
    By revathi17 in forum New To Java
    Replies: 2
    Last Post: 08-08-2007, 08:40 PM
  3. Writing the filter method
    By ai_2007 in forum Advanced Java
    Replies: 1
    Last Post: 07-03-2007, 04:32 PM

Posting Permissions

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