Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
Comparing elements in a sets?
Bob Zoloman
Ranch Hand
Posts: 72
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
If I have two different sets
set a: [14, 2, 30]
set b: [25, 19, 2]
how can I figure out which elements in one set has elements in another set, and print that element out? Any help is appreciated, thanks.
Keith Lynn
Ranch Hand
Posts: 2412
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Do you mean how do you find out the common elements between the Sets?
If you look at the API docs for Set, any class that implements Set must implement a method called retainAll.
Look at the API docs for that method and
you should
see how you can use it.
Bob Zoloman
Ranch Hand
Posts: 72
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks, that method is exactly what I needed.
You got style baby! More than this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Fibonacci Sum
help me with array
how to compare elements of List
Collections question
Array index
More...