Results 1 to 2 of 2
Thread: Real life example of iteration
- 06-19-2011, 08:10 PM #1
Member
- Join Date
- Feb 2011
- Posts
- 78
- Rep Power
- 0
Real life example of iteration
I need a little help with an assignment, to come up with a real-world example of iteration, and how it can be achieved recursively.
I was thinking of someone looking for something inside of a box, maybe a specific item:
Would you consider this to be a good real iteration example?Java Code:public boolean containsItem(){ Iterator itr = Box.contents().iterator; Object myItem = paper; while(itr.hasNext()){ item i = itr.next(); if (i == myItem){ return i; } } return false }Last edited by fam2315; 06-19-2011 at 08:13 PM.
- 06-19-2011, 08:33 PM #2
Similar Threads
-
Suggestion on packages to use when connecting java with wireless real life objects
By Addez in forum New To JavaReplies: 1Last Post: 05-24-2011, 10:25 PM -
Two Dimensional Array Iteration Help
By Stamoulohta in forum New To JavaReplies: 5Last Post: 03-13-2011, 01:39 PM -
Double Iteration Over a Hashmap
By Gusy in forum New To JavaReplies: 1Last Post: 12-01-2010, 01:01 AM -
Arrays, Iteration and selection (Cache)
By dietgal in forum New To JavaReplies: 17Last Post: 10-11-2008, 07:44 AM -
Enum Iteration
By A.Russell in forum New To JavaReplies: 1Last Post: 08-15-2007, 12:17 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks