Hallo, kann jemand mir bitte erklären was diese Methoden machen?
Java:
public static <T> void randomQuery(Collection<T> collection, Vector<T> query) {
long t = System.currentTimeMillis();
for (T entry : query)
collection.contains(entry);
t = System.currentTimeMillis() - t;
String identifier = collection.getClass().getName();
System.out.println("//Accessing " + identifier
+ " took time in seconds:\n " + t * 0.001);
}
public static <T> Vector<T> createQuery(Collection<T> collection,
double threshold) {
Random generator = new Random(42);
Vector<T> result = new Vector<>();
for (T entry : collection)
if (generator.nextDouble() < threshold)
result.add(entry);
return result;
}
Zuletzt bearbeitet: