I am trying to crate a code, which calculates Java Map's containsKey -operation in nanoseconds (like how fast it runs that operation). Method has a Map<Double, Double> D as a parameter, and the value returned should be containsKey operations' normal use of time as nanoseconds. I have really no clue, how to continue this. Netbeans IDE gives error message, which says that I have some kind of infinite loop here.
Here is my code so far:
import java.util.*;
public class calculateNanotime implements calculateNanotime{
   /* 
     * Measures Map's containsKey -operaation's time frequency as nanoseconds.
     * @param D Map to be tested
     * @return containsKey -operation's duration as nanoseconds
     */
    //@Override
    public long containsKeyTime(Map<Double, Double> D) {
        // I should try with different key values
        D.containsKey(1.0);
     
        long beginning = System.nanoTime();
        long end = System.nanoTime();
        
        long result = end - beginning;
    
 //I have a code in another class of this package, which will be testing how well this code work, after this is ready
        result = testable.containsKeyTime(D);
          return result;
}
}
Here are the erroe messages: Exception in thread "main" java.lang.StackOverflowError at calculateNanotime.calculateNanotime.containsKeyTime(calculateNanotime.java:35)
at calculateNanotime.calculateNanotime.containsKeyTime(calculateNanotime.java:42)
 
     
    