CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    Join Date
    Jul 2011
    Posts
    18

    This exercise is not particularly difficult, but the concepts are new.Can u Solve it

    Exercise 12.4: A predicate is a boolean-valued function with one parameter. Some languages use predicates in generic programming. Java doesn't, but this exercise looks at how predicates might work in Java.

    In Java, we could use "predicate objects" by defining an interface:

    public interface Predicate {
    public boolean test(Object obj);
    }

    The idea is that an object that implements this interface knows how to "test" objects in some way. Define a class Predicates that contains the following generic methods for working with predicate objects:

    public static void remove(Collection coll, Predicate pred)
    // Remove every object, obj, from coll for which
    // pred.test(obj) is true.

    public static void retain(Collection coll, Predicate pred)
    // Remove every object, obj, from coll for which
    // pred.test(obj) is false. (That is, retain the
    // objects for which the predicate is true.)

    public static List collect(Collection coll, Predicate pred)
    // Return a List that contains all the objects, obj,
    // from the collection, coll, such that pred.test(obj)
    // is true.

    public static int find(ArrayList list, Predicate pred)
    // Return the index of the first item in list
    // for which the predicate is true, if any.
    // If there is no such item, return -1.


    In Java Here is The solution is --->http://www.java2s.clanteam.com/c12/ex-12-4-answer.html

    (In C++, methods similar to these are included as a standard part of the generic programming framework.)

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    And the point of cutting and pasting this text from the linked to site is what?
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    This OP is also posting this junk on other forums.
    Norm

  4. #4
    Join Date
    Jul 2011
    Posts
    18

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    this is not a junk this is a way to help student
    if u mind this is ur business but i m here to help
    and ask anybody about those exercises or check them urself and u ll find that is kinda hard to
    solve and u ll figure out that it discuss with a professional way .

    and stop sayin junk about those exercises they r been created by the most expert people
    of Java Language

  5. #5
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    The quality of the exercises is not relevant. You are posting them on a question and answer forum and they do not conform to the forum's posting rules and so Norm is right to say they are Junk
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  6. #6
    Join Date
    Jul 2011
    Posts
    18

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    so you call David J. Eck junk he could probably have tought ur professors
    and you call him a junk

    or just u r makin it personal defendin on ur friend

    let people judge about the exercises and u ll find that you are so wrong

  7. #7
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    No, I am not calling David J. Eck's work junk - I haven't read any of his stuff so can't comment on it.

    I'm saying in the context of this site what you posted was junk. Just posting random chunks of text cut and pasted from an on-line book does not help anyone - it's junk.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  8. #8
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    There are lots of good sites on the internet. Mr. Eck's is probably a good one.
    However, It is slightly dated: about 7 years old.
    If too many people copy bits and pieces of all the good sites to this site, it would make it too cluttered.
    I'd prefer keeping the posts to people with problems.
    Norm

  9. #9
    Join Date
    Jul 2011
    Posts
    18

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    no no u didn t say that go aback and read ur Comment u sed the quality of the exercise is not relevant and u said norm is right to call them junk that means plural that mean u have been talkin about the exercises in Dr David J. Eck's and i m postin one of his exercises
    other way i m new here u shouldn t have said just this is not a good way to treat new people
    if you keep callin doctors Junk Whenever somebody new come to this Good Forum
    he won t come back again this is not a good way u r using to treat new People around Codeguru Forum

  10. #10
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    no no u didn t say that go aback and read ur Comment u sed the quality of the exercise is not relevant and u said norm is right to call them junk
    I suggest you you re-read my post and take the time to digest what I said before you get all critical.

    "The quality of the exercise is not relevant" means it doesn't matter how good or bad the exercise is with regard to this discussion. It is not a comment on whether or not I think it is a good or bad exercise.

    "You are posting them on a question and answer forum and they do not conform to the forum's posting rules and so Norm is right to say they are Junk" means they are junk because they are not relevant to this site, again not a comment on whether or not I think they are a good or bad.

    i m new here u shouldn t have said just this is not a good way to treat new people
    if you keep callin doctors Junk Whenever somebody new come to this Good Forum
    he won t come back again this is not a good way u r using to treat new People around Codeguru Forum
    If you'd read the forums posting rules before posting, which you are supposed to do, we wouldn't even be having this discussion. BTW if you want further replies here type in English and not text speak. Many people here are not native English speakers and struggle to understand such abbreviations.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  11. #11
    Join Date
    Jul 2011
    Posts
    18

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    well there is a Contradiction about what you r sayin , you told me that i should speak english becoz alot of poeple here strugglin to understand English ,so why couldn t yo make it it clear so can foreign poeple understand what u are about instead of sayin ur Exercises are junk and not relevant ..

    and i don t think that there is one rule that mind the way i wrote my stuff here.

    and an other contradiction u said the OP is also postin this junk on other forums ,i Don t think that Poeple who are strugglin to understand enlish would understand this ,

    if i were you i would like to see this thing contains before i jugde it as a junk ,


    what i think that if you keep treatin poeple this way and call their stuff junk this would
    decrease the numbers of visitors here , i was here suggestin some methods so can poeple improve their java language and meanwhile decreasin the number of visitor and you r doing the opposite ,

  12. #12
    Join Date
    Feb 2008
    Posts
    966

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    Quote Originally Posted by liamsi View Post
    well there is a Contradiction about what you r sayin , you told me that i should speak english becoz alot of poeple here strugglin to understand English ,so why couldn t yo make it it clear so can foreign poeple understand what u are about instead of sayin ur Exercises are junk and not relevant ..
    So what you are saying, is that we should all learn to speak in broken English so that foreigners can understand better? Maybe we should use internet leet speak as well, or even Ebonics.

    Quote Originally Posted by liamsi View Post
    and i don t think that there is one rule that mind the way i wrote my stuff here.
    Try actually reading it, then come back and say this. This forum is for asking questions, not promoting another site.

    Quote Originally Posted by liamsi View Post
    and an other contradiction u said the OP is also postin this junk on other forums ,i Don t think that Poeple who are strugglin to understand enlish would understand this ,
    I really don't think that you are in any position to talk to us about proper English.

    Quote Originally Posted by liamsi View Post
    what i think that if you keep treatin poeple this way and call their stuff junk this would
    decrease the numbers of visitors here
    , i was here suggestin some methods so can poeple improve their java language and meanwhile decreasin the number of visitor and you r doing the opposite ,
    So what you are saying, is that you are trying to decrease the number of visitors that we get in favor of your site, but if we keep talking to you like this we are going to decrease our numbers. Isn't that a win/win for you? I might be a bit confused here though.

  13. #13
    Join Date
    Feb 2008
    Posts
    966

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    Also, I would suggest that nobody click on the links he has provided. NONE of the Java2s links reroute you to anything like www.java2s.clanteam.com, all of them stay at www.java2s.com. There is no telling what this person is doing impersonating this IP address and WHOIS has no information.

  14. #14
    Join Date
    Jul 2011
    Posts
    18

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    i donno what yo r tryin to program ,ProgramThis ,you should Listen to ur friend when he said that i should have of read the rules Before Postin ,you should have respect the rules of discussion you can t sleep for 2 or 3 days and get along with a arguiment that has been open for ages ,and i donno why u r tryin to improve by ur laughin emotions , to be a Java Expert which u think urself you , u have to be old enough , you can just come here and send like those laughin emotions , ur friends was tellin Dr David J. Eck works junk and u r laughin at him ,
    u weep for ur friends and you course this Doctor work , u can make it personal i m here to help
    and u r reactin like i have stolen ur girlfriend or somethin

  15. #15
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve

    Quote Originally Posted by liamsi View Post
    i donno what yo r tryin to program ,ProgramThis ,you should Listen to ur friend when he said that i should have of read the rules Before Postin ,you should have respect the rules of discussion you can t sleep for 2 or 3 days and get along with a arguiment that has been open for ages ,and i donno why u r tryin to improve by ur laughin emotions , to be a Java Expert which u think urself you , u have to be old enough , you can just come here and send like those laughin emotions , ur friends was tellin Dr David J. Eck works junk and u r laughin at him ,
    u weep for ur friends and you course this Doctor work , u can make it personal i m here to help
    and u r reactin like i have stolen ur girlfriend or somethin
    It's not clear whether English is your native language, but if it is, please don't use text-speak abbreviations when posting here. We have many people for whom English is a second or third language who find text like that very difficult to follow. I suspect we have more than a few native English speakers who also find it hard to follow. A bit more clarity of expression and grammar would help too.

    If you're posting from your phone, please either spell out words correctly or wait until you have access to a more convenient keyboard.

    Please don't post irrelevant book exercises, or articles, etc., whatever the quality. By all means post links to resources elsewhere, but bear in mind that the purpose of this forum is to help people who are stuck or having difficulty writing Java code. This is not a tutorial forum.

    If you have a Java problem you are stuck on, please post it. If not, you're probably in the wrong forum.

    The greatest obstacle to discovery is not ignorance, but the illusion of knowledge...
    D. Boorstin
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Page 1 of 2 12 LastLast

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured