5 Replies Latest reply on Jun 28, 2010 2:26 PM by 843793

    How can I copy a hashmap to an array?

      In the following code I have tried to copy a hash-map to array of map entries. Because I need to compare each value by next and previous values and detect local maximums.
      But when I run this I get java.lang.NullPointerException in toArray(a) function.
      Please help me. What Do I have to do to create an array of map entries of a hash-map?
      Map.Entry<String, Float>[] a = null;
      for (int i = 1; i < a.length-1 ; i++) {
           if (a.getValue()>a[i-1].getValue() && a[i].getValue()>a[i+1].getValue()) {
      By the way, If exist another solution to comparing three adjacent values in hash-map, please tell me.
      Thanks for any help.