# Java版排列组合工具类 - Java Permutation and Combination Tools

public class PNCDemo {

public static void main(String[] args) {

System.out.println("===== demo permutation :");
for(List<String> list : Permutation.of(Arrays.asList("a", "b", "c")))
System.out.println(list);
}
}

run:
===== demo permutation :
[a, b, c]
[a, c, b]
[b, a, c]
[b, c, a]
[c, a, b]
[c, b, a]
BUILD SUCCESSFUL (total time: 0 seconds)

public class PNCDemo {

public static void main(String[] args) {

System.out.println("===== demo combination :");
for(List<Integer> list : Combination.of(Arrays.asList(1, 2, 3, 4, 5), 3))
System.out.println(list);
}
}

run:
===== demo combination :
[1, 2, 3]
[1, 2, 4]
[1, 2, 5]
[1, 3, 4]
[1, 3, 5]
[1, 4, 5]
[2, 3, 4]
[2, 3, 5]
[2, 4, 5]
[3, 4, 5]
BUILD SUCCESSFUL (total time: 0 seconds)

public class PNCDemo {

public static void main(String[] args) {

System.out.println("===== demo both :");
for(List<Integer> list : Permutation.of(Arrays.asList(1, 2, 3, 4, 5), 3))
System.out.println(list);
}
}

run:
===== demo both :
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
[1, 2, 4]
[1, 4, 2]
[2, 1, 4]
[2, 4, 1]
[4, 1, 2]
[4, 2, 1]
[1, 2, 5]
[1, 5, 2]
[2, 1, 5]
[2, 5, 1]
[5, 1, 2]
[5, 2, 1]
[1, 3, 4]
[1, 4, 3]
[3, 1, 4]
[3, 4, 1]
[4, 1, 3]
[4, 3, 1]
[1, 3, 5]
[1, 5, 3]
[3, 1, 5]
[3, 5, 1]
[5, 1, 3]
[5, 3, 1]
[1, 4, 5]
[1, 5, 4]
[4, 1, 5]
[4, 5, 1]
[5, 1, 4]
[5, 4, 1]
[2, 3, 4]
[2, 4, 3]
[3, 2, 4]
[3, 4, 2]
[4, 2, 3]
[4, 3, 2]
[2, 3, 5]
[2, 5, 3]
[3, 2, 5]
[3, 5, 2]
[5, 2, 3]
[5, 3, 2]
[2, 4, 5]
[2, 5, 4]
[4, 2, 5]
[4, 5, 2]
[5, 2, 4]
[5, 4, 2]
[3, 4, 5]
[3, 5, 4]
[4, 3, 5]
[4, 5, 3]
[5, 3, 4]
[5, 4, 3]
BUILD SUCCESSFUL (total time: 0 seconds)

/*
*
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
*/
import java.math.BigInteger;

/**
* This class
• 5
点赞
• 10
收藏
觉得还不错? 一键收藏
• 1
评论
10-02
01-13
02-20 555
08-08 395
08-15 3096

### “相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、付费专栏及课程。