This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Performance and the fly likes Prune a List of Lists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Prune a List of Lists" Watch "Prune a List of Lists" New topic
Author

Prune a List of Lists

A Jaco
Greenhorn

Joined: Jan 25, 2012
Posts: 4
I want to ensure that a List of Lists contains no element which is subsumed by another. Each nested List should contain at least one unique element compared to any other nested List.
This code works, but seems horribly inefficient. Is there a better way?

Alexei Kaigorodov
Greenhorn

Joined: Feb 24, 2008
Posts: 17
A Jj wrote:

When list2.equals(list1), why don't you remove one of them?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Prune a List of Lists
 
Similar Threads
Simple ArrayList conundrum?
Three Dimensional ArrayList?
Compare the values in 2 array.
Collection
Comparing Array Elements