Returns true if the second list is a permutation of the first.
(List<?> first, List<?> second)
| 668 | */ |
| 669 | |
| 670 | private static boolean isPermutation(List<?> first, List<?> second) { |
| 671 | if (first.size() != second.size()) { |
| 672 | return false; |
| 673 | } |
| 674 | Multiset<?> firstMultiset = HashMultiset.create(first); |
| 675 | Multiset<?> secondMultiset = HashMultiset.create(second); |
| 676 | return firstMultiset.equals(secondMultiset); |
| 677 | } |
| 678 | |
| 679 | private static boolean isPositiveInt(long n) { |
| 680 | return n >= 0 && n <= Integer.MAX_VALUE; |