Results 1 to 2 of 2
  1. #1
    wulfgarpro is offline Member
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0

    Default Collection Interator

    Hi,

    Java Code:
    static void filter(Collection<?> c) {
        for (Iterator<?> it = c.iterator(); it.hasNext(); )
            if (!cond(it.next()))
                it.remove();
    }
    What exactly does !cond mean ? I cant seem to see any boolean variables.. is this pseudo ?

    wulfgarpro.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    cond is a method (and is one that we currently don't see the declaration or the body) that is in the current class and it must take an Object as a parameter and return a boolean result.

Similar Threads

  1. how to use genirics in collection
    By ashokreddy.narra in forum New To Java
    Replies: 3
    Last Post: 08-10-2010, 10:33 AM
  2. help for collection api
    By javastuden in forum New To Java
    Replies: 3
    Last Post: 02-24-2010, 12:52 PM
  3. Collection Types
    By DavidG24 in forum New To Java
    Replies: 2
    Last Post: 04-18-2009, 06:03 PM
  4. How to get NamingEnumeration from my collection?
    By hencre in forum Advanced Java
    Replies: 1
    Last Post: 10-18-2008, 09:01 PM
  5. Collection - java
    By Moonlightkid in forum Advanced Java
    Replies: 3
    Last Post: 09-02-2008, 06:04 AM

Posting Permissions

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