-
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.)
-
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?
-
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.
-
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
-
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
-
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
-
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.
-
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.
-
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
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
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.
Quote:
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.
-
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 ,
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
Originally Posted by
liamsi
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. :rolleyes:
Quote:
Originally Posted by
liamsi
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
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. :lol:
Quote:
Originally Posted by
liamsi
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. :D
-
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.
-
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
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
Originally Posted by
liamsi
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
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
date of join 1999 that makes more powerful than your previous friends ,no actually English is not my native Language, but i speak about 4 or 5 languages and i understand English with all its accents , but with all my respect i disagree with you when u said that that you find more than one native english people who find my post hard to follow ,
it is kind of clear unlike what you have said because i don t know how can i give some explanition to someone who doesn need help,and it takes him more than one page to understand , it could be easy to follow some helpful link ,and of course he d remember that this forum is the source ,
and i don t understand the way you end your replay all of you it is the same bad conclusion
like sayin Junk , or should look for other forum ,or you are a bit confusing...
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
Originally Posted by
liamsi
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.
This is not a new concept. It's called functional programming. But it's true that Java doesn't support it much. There was a suggestion to introduce so called closures in Java 7 but it seems to have been postponed. (C++ has closures in its upcoming standard and C# has had them for some time).
There have been attempts (not very successful) over the years to popularize the functional approach for Java. See here for example,
http://www.ibm.com/developerworks/ja...-fp/index.html
And here's a library,
http://commons.apache.org/sandbox/functor/
For those interested in trying a specialized functional language there's Clojure (which runs both on the JVM and the CLR) and F# which is a .NET language. Or even better Scala which is both functional and object oriented and well integrated with Java,
http://www.scala-lang.org/node/25
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
Originally Posted by
liamsi
so you call David J. Eck junk he could probably have tought ur professors and you call him a junk
A forum is not well suited for general billboarding or personal blogging that's all.
Recommend the book when someone has expressed a specific wish or concern you feel it would satisfy. Or write a review if you feel it's very novel or special and invite to a discussion.
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
Originally Posted by
liamsi
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
Please enlighten me and show me where it says in the rules for the discussion forum that I cannot "sleep for 2 or 3 days" and join a discussion? Oh, is this some sort of 'unspoken' rule from Malaysia? The 'argument', as you put it, has been going on for 2 days... hardly 'ages'.
Quote:
Originally Posted by
liamsi
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
So you have taken the information already freely provided by the good Dr, placed it on your own version of a web page, and are now promoting it. Why not at least link to the original author's page instead of proxying it through your site?
Once again, because you do not seem to understand the concept here, this is a site for people to ask questions. This is NOT a site for people to spam their favorite author's work. If you find that somebody has asked a question that the good Dr has solved, THEN you should post a link to the relevant piece of information that explains how to solve the problem.
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
to solve the problem i ve got to get back to the previous post by nuzzle,this is not nuzzling
the way post ur comments has nottin to do with nuzzling ,when i said this is a new concept i didn t mean the exercise itself , i meant how people may find it that s why i have pointed to C++.
if u read the whole thing you wouldn t say that , i bet everybody understand what i was about except from you Members ,i bet you treat all people the same way ,i donno what you r tryin to prove but i think i can understand , like i said this is not personal so i don t care ,
i don t even understand why do u have the right to tell me about other links like Ibm and
common.apach and scala and i can 't ??
let me go back to the last post before u r tryin to accusin people u have to think about Silent is golden when u can t think about a good answer, becuz what he wasnt Dr is his work to be shared ,if it has a lot of sources people may come across it , like for example my country
if somebody don t get somethin i may edit this thing and try to write it an other way ,
the point is to make it so easy to be understood by not just native english speaker .
you all talk the same way like u r neighbours or roomates or studyin in the same place
i don t know it seems to me like you have been thought from one source and the same source
.i think if you want to understand somethin and trust it you have to look at it from different position .
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
i bet everybody understand what i was about except from you Members
Look, if someone here or on any other web site disagrees with a post you've made then that's not unusual but when everyone disagrees with you and are presenting a common front in disagreeing with you then you have to accept that you are probably in the wrong or at the very least on the wrong site.
Quote:
,i bet you treat all people the same way
Well we certainly try to be consistent.
Quote:
i don t even understand why do u have the right to tell me about other links like Ibm and
common.apach and scala and i can 't ??
Because Nuzzle was posting useful links in support of his/her response to your post. A number of people have already told you it's ok to post links for this book if it is in order to answer a question someone has asked.
Quote:
you all talk the same way like u r neighbours or roomates or studyin in the same place
I can't speak for the others but I've never met or had any communication outside this site with any of them. In fact I believe we are spread across several different countries.
What we do have in common is an understanding of what this forum is for and how people should use it.
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
u r all from UK and Some of I guess is From USA And the more powerful Here i donno the one who was joined on 199 and u all wanna be like him ,and an other one who is somehow love to search over google and tell people what he think as an answer i think the name was Programmthis ,and yes i disagree with the 4 or 5 of you it is a small number ,cuz i know the truth that i m right and i was right like i was right when i told you that you have to look at things from different side ,like i believe you when u said that you guys don t have conversation or communication outside internet , that an other side you should look at thing , i mean social Life
,it s harder than Java Language more Complicated , and the way you talk prove that you have nothin to do with it
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
Originally Posted by
liamsi
u r all from UK and Some of I guess is From USA And the more powerful Here i donno the one who was joined on 199 and u all wanna be like him ,and an other one who is somehow love to search over google and tell people what he think as an answer i think the name was Programmthis ,and yes i disagree with the 4 or 5 of you it is a small number ,cuz i know the truth that i m right and i was right like i was right when i told you that you have to look at things from different side ,like i believe you when u said that you guys don t have conversation or communication outside internet , that an other side you should look at thing , i mean social Life
,it s harder than Java Language more Complicated , and the way you talk prove that you have nothin to do with it
Incomprehensible ramblings in a style that doesn't fit the situation. I don't think anyone would consider that an example of good social skills. And you can stop crusading now. It's been duly noted that you consider these lecture notes a gift from heaven, a must read for every ambitious Java developer.
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Hopefully, now he's decided that we're all social inadequates, he'll realize this forum isn't what he thought it was, that there's little point wasting his time here, and he'll stop wasting our time.
Alternatively, we can just get on with normal forum business and leave him to his ramblings.
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law...
D. Hofstadter
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
Originally Posted by
dlorde
Alternatively, we can just get on with normal forum business and leave him to his ramblings.
To me this thread was valuable because it brought my attention to Scala which is both object oriented and functional, and well integrated with Java. It seems like a nice choise if you want to improve as a programmer in general.
In addition to the link I gave in a previous post I recommend this,
http://drdobbs.com/architecture-and-...allout-mostpop
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
Originally Posted by
nuzzle
Thanks nuzzle, it's an interesting interview - and a long time since I browsed Dr Dobbs; I used to get the journal many years ago...
]Who dares to teach must never cease to learn...
J.C. Dana
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
Originally Posted by
dlorde
Thanks nuzzle, it's an interesting interview - and a long time since I browsed Dr Dobbs; I used to get the journal many years ago...
There aren't many programming magazines you can buy in the stores these days. I guess they all went to Mexico. :)
I suppose it's because of a lack of public interest in programming. There are no hobby programmers anymore, just professionals and academics. And as the exception that proves the rule, Linux affectionados. They can still buy a magazine in a store but that's not quite the same because Linux is not a programming language.
It was very different during the Java heydays. There were at least three different Java journals on the shelves and people were fighting to get their hands on a new issue. Java knowledge could even get you laid. Sadly, these days are long gone and I wonder what could ever spark another surge of interest in programming the way Java did.
I see a pattern here; First the IBM PC and then Java. What do they have in common? They were a platform! The IBM PC wasn't just a computer, it was a platform. Java wasn't just a language, it was a platform.
So what's next? Well, honestly I don't know but I'm sure it will have something to do with a new platform. :)
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
Quote:
Originally Posted by
nuzzle
Java knowledge could even get you laid.
Dang! I knew I'd missed something... I wuz too busy being a geek :rolleyes:
Quote:
So what's next? Well, honestly I don't know but I'm sure it will have something to do with a new platform. :)
It's getting complicated - platforms are merging; everything is a computer now, with multi-media and multi-source access. My new Samsung TV has it's own wireless web interface for streamed audio/video, with a browser, custom Twitter and Facebook areas, and downloadable apps (mostly pointless junk). You can plug a PC in, but you don't really need to. It's like a 37" iPad... :eek:
On a visit to the NASA space center, President Kennedy spoke to a man sweeping up in one of the buildings. "What's your job here?" asked Kennedy. "Well Mr. President," the janitor replied, "I'm helping to put a man on the moon"...
Anon.
-
Re: This exercise is not particularly difficult, but the concepts are new.Can u Solve
i don t get i have been facin alot of issues but they don bother me ,but sometimes i don t get how humain being thinks , i don t get i m here to offer help n provide some java students with excercises ,but i don t get the way you people speak , it s very wierd you r members of this webite you should be a very friendly, people this is business ...this is the first concept you should have learnd .