# commons-user mailing list archives

##### Site index · List index
Message view
Top
From "Wes Clark" <wcl...@guidewire.com>
Subject RE: [Collections] "For each pair" iterator
Date Wed, 02 Apr 2008 16:27:32 GMT
```I believe that is called the "power set".

-----Original Message-----
From: jcarman@carmanconsulting.com [mailto:jcarman@carmanconsulting.com]
On Behalf Of James Carman
Sent: Wednesday, April 02, 2008 9:26 AM
To: Jakarta Commons Users List
Subject: Re: [Collections] "For each pair" iterator

That's more of a combinatorics problem.  Perhaps math would be
interested in something like that?

On Wed, Apr 2, 2008 at 12:20 PM, Pedro Pedruzzi <ppedruzzi@v2com.mobi>
wrote:
> Hi,
>
>  What I'd like to do is iterate through each subset of size 2 of a
Set.
>
>  Example:
>
>  My set is: S = {1,2,3,4}
>  I'd like to iterate throught every one of these subsets:
>  {1,2}, {1,3}, {1,4}, {2,3}, {2,4} and {3,4}.
>
>
>
>  --
>  Pedro Pedruzzi |  V2COM | +55 11 3094-3939
>
>
>
>
> On Mon, Mar 31, 2008 at 11:59 PM, GUPTA GAURAV KUMAR
> <Gaurav_Kumar.Gupta@alcatel-lucent.com> wrote:
>  > Hi
>  >

> >  example.
>  >
>  >  KR
>  >  Gaurav Kumar
>  >
>  >
>  >  -----Original Message-----
>  >  From: Pedro Pedruzzi [mailto:ppedruzzi@v2com.mobi]  >  Sent:
> Tuesday, April 01, 2008 3:56 AM  >  To: user@commons.apache.org  >
> Subject: [Collections] "For each pair" iterator  >  >  >  > Hi guys,
> >  >  I have a java.util.Set and I'd like to do a iteration like "for
> each  >  to distinct pair of elements" do something. In this case I
> don't care  >  for the ordering of the pair. A most precise way would
> be: "for each  >  subset of size 2" do something.
>  >
>  >  Do the Apache Commons Collections provide some class to do this?
>  >
>  >
>  >  --
>  >  Pedro Pedruzzi | V2COM | +55 11 3094-3939
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org