org.jgroups.tests.CheckGaps Maven / Gradle / Ivy
Go to download
This artifact provides a single jar that contains all classes required to use remote Jakarta Enterprise Beans and Jakarta Messaging, including
all dependencies. It is intended for use by those not using maven, maven users should just import the Jakarta Enterprise Beans and
Jakarta Messaging BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up
with different versions on classes on the class path).
package org.jgroups.tests;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Set;
import java.util.HashSet;
/** Reads a sequence of numbers from stdin and verifies that they are in order
* @author Bela Ban
*/
public class CheckGaps {
public static void main(String[] args) {
SortedSet set=new TreeSet<>();
for(int i=0; i < args.length; i++) {
set.add(Integer.parseInt(args[i]));
}
int low=set.first(), high=set.last();
System.out.println("input has " + set.size() + " numbers, low=" + low + ", high=" + high);
Set correct_set=new HashSet<>();
for(int i=low; i < high; i++) {
correct_set.add(i);
}
correct_set.removeAll(set);
System.out.println("missing seqnos: " + correct_set);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy