GraphPartition { public static <L extends Serializable> List<L> getPermutedLabels(List<L> originalLabels, int[] permutations) { Preconditions.checkArgument(permutations.length == originalLabels.size(), "The permutation vector and labels must have the same length"); List<L> result = Lists.newArrayListWithCapacity(originalLabels.size()); for (int perm : permutations) { L label = originalLabels.get(perm); result.add(label); } return result; }  static LabeledMTJMatrix<X> getMentionMatrix(List<T> data,
                                            Function<T, X> funcX,
                                            Function<T, Y> funcY); static LabeledDenseMatrix<L> getSimilarityMatrix(
            LabeledMTJMatrix<L> labeledMatrix); static Matrix getPermutedMatrix(Matrix A, int[] permutations); static List<L> getPermutedLabels(List<L> originalLabels,
                                                                     int[] permutations);  }
@Test public void testGetPermutedLabels() { int[] permutations = new int[] { 2, 1, 3, 0 }; List<String> originalLabels = ImmutableList.of("e1", "e2", "e3", "e4"); List<String> result = GraphPartition.getPermutedLabels(originalLabels, permutations); List<String> expectedResult = ImmutableList.of("e3", "e2", "e4", "e1"); assertEquals(expectedResult, result); }
@Test(expected = IllegalArgumentException.class) public void testGetPermutedLabels_withInconsistentLengths() { GraphPartition.getPermutedLabels(ImmutableList.of("e1"), new int[] { 2, 1 }); }