Java Utililty Methods List Compare

List of utility methods to do List Compare

Description

The list of methods to do List Compare are organized into topic(s).

Method

booleancompareTwoListOfStrings(List first, List second)
compare Two List Of Strings
boolean result = false;
int contCompare = 0;
for (int i = 0; i < first.size(); i++) {
    String data = first.get(i);
    if (data.equals(second.get(i))) {
        contCompare++;
if (contCompare == first.size()) {
    result = true;
return result;
voidcompareVectors(List vectorA, List vectorB)
compare Vectors
final int rowsA = vectorA.size();
final int rowsB = vectorB.size();
if (rowsA != rowsB) {
    throw new RuntimeException(
            String.format("vector A dimension (%d) differs from dimension of vector B (%d)", rowsA, rowsB));
for (int y = 0; y < vectorA.size(); y++) {
    double valA = vectorA.get(y);
...
booleanequalsToAny(Object comparable, Object... compareList)
equals To Any
return Arrays.asList(compareList).contains(comparable);
ListparseAndCompare(List fileNames, int masterPartitionId)
This method take a list of fileName of the type partitionId_Replica_Chunk and returns file names that match the regular expression masterPartitionId_
List<String> sourceFileNames = new ArrayList<String>();
for (String fileName : fileNames) {
    String[] partitionIdReplicaChunk = fileName.split(SPLIT_LITERAL);
    if (Integer.parseInt(partitionIdReplicaChunk[0]) == masterPartitionId) {
        sourceFileNames.add(fileName);
return sourceFileNames;
...
voidsortList(List sources, Comparator comparer)
sort List
if (isEmpty(sources) || comparer == null) {
    return;
Collections.sort(sources, comparer);